diff --git a/Buffs/Afflicted.cs b/Buffs/Afflicted.cs index 1589e06420..2cab8dffc1 100644 --- a/Buffs/Afflicted.cs +++ b/Buffs/Afflicted.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Buffs public override void SetDefaults() { DisplayName.SetDefault("Afflicted"); - Description.SetDefault("Rage is power"); + Description.SetDefault("Empowered by otherworldly spirits"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; @@ -21,7 +21,7 @@ namespace CalamityMod.Buffs public override void Update(Player player, ref int buffIndex) { - player.GetModPlayer(mod).afflictedBuff = true; + player.GetModPlayer(mod).afflicted = true; } } } \ No newline at end of file diff --git a/Buffs/AkatoYharonBuff.cs b/Buffs/AkatoYharonBuff.cs new file mode 100644 index 0000000000..54c693baaf --- /dev/null +++ b/Buffs/AkatoYharonBuff.cs @@ -0,0 +1,31 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class AkatoYharonBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Akato"); + Description.SetDefault("'Looks like you'll have to take care of it now'"); + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.GetModPlayer(mod).akato = true; + bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Akato")] <= 0; + if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("Akato"), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} \ No newline at end of file diff --git a/Buffs/AkatoYharonBuff.png b/Buffs/AkatoYharonBuff.png new file mode 100644 index 0000000000..3a0c1190bf Binary files /dev/null and b/Buffs/AkatoYharonBuff.png differ diff --git a/Buffs/ArmorCrumbling.cs b/Buffs/ArmorCrumbling.cs new file mode 100644 index 0000000000..03404561ce --- /dev/null +++ b/Buffs/ArmorCrumbling.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class ArmorCrumbling : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Armor Crumbling"); + Description.SetDefault("Melee and rogue attacks break enemy armor"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).armorCrumbling = true; + } + } +} \ No newline at end of file diff --git a/Buffs/ArmorCrumbling.png b/Buffs/ArmorCrumbling.png new file mode 100644 index 0000000000..91c59e2816 Binary files /dev/null and b/Buffs/ArmorCrumbling.png differ diff --git a/Buffs/ArmorShattering.cs b/Buffs/ArmorShattering.cs new file mode 100644 index 0000000000..ea2624d20e --- /dev/null +++ b/Buffs/ArmorShattering.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class ArmorShattering : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Armor Shattering"); + Description.SetDefault("Melee and rogue attacks break enemy armor"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).armorShattering = true; + } + } +} \ No newline at end of file diff --git a/Buffs/ArmorShattering.png b/Buffs/ArmorShattering.png new file mode 100644 index 0000000000..a6f7386e81 Binary files /dev/null and b/Buffs/ArmorShattering.png differ diff --git a/Buffs/AstralInjectionBuff.cs b/Buffs/AstralInjectionBuff.cs new file mode 100644 index 0000000000..52c96d9c9d --- /dev/null +++ b/Buffs/AstralInjectionBuff.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class AstralInjectionBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Astral Injection"); + Description.SetDefault("Extreme mana recovery"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).astralInjection = true; + } + } +} \ No newline at end of file diff --git a/Buffs/AstralInjectionBuff.png b/Buffs/AstralInjectionBuff.png new file mode 100644 index 0000000000..d9a30ea457 Binary files /dev/null and b/Buffs/AstralInjectionBuff.png differ diff --git a/Buffs/BoundingBuff.cs b/Buffs/BoundingBuff.cs new file mode 100644 index 0000000000..7e4b4a2856 --- /dev/null +++ b/Buffs/BoundingBuff.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class BoundingBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Bounding"); + Description.SetDefault("Increased jump height, jump speed, and fall damage resistance"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).bounding = true; + } + } +} \ No newline at end of file diff --git a/Buffs/BoundingBuff.png b/Buffs/BoundingBuff.png new file mode 100644 index 0000000000..f94704f48d Binary files /dev/null and b/Buffs/BoundingBuff.png differ diff --git a/Buffs/BurningBlood.cs b/Buffs/BurningBlood.cs index 9e529a9e63..1bc7009d89 100644 --- a/Buffs/BurningBlood.cs +++ b/Buffs/BurningBlood.cs @@ -23,5 +23,10 @@ namespace CalamityMod.Buffs { player.GetModPlayer(mod).bBlood = true; } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).bBlood = true; + } } } \ No newline at end of file diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index a21d641c0d..81729336db 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -71,21 +71,6 @@ namespace CalamityMod.Buffs tip = "15% increased damage"; if (type == BuffID.NebulaUpDmg3) tip = "22.5% increased damage"; - if (type == BuffID.ChaosState) - { - if (CalamityWorld.revenge) - { - int closestPlayer = (int)Player.FindClosest(new Vector2((float)(Main.maxTilesX / 2), (float)Main.worldSurface / 2f) * 16f, 0, 0); - if (!Main.player[closestPlayer].GetModPlayer(mod).normalityRelocator) - tip = "Using the Rod of Discord will take life and damage taken is increased by 50%"; - else - tip = "Using the Rod of Discord or Normality Relocator will take life"; - } - else - { - tip = "Using the Rod of Discord or Normality Relocator will take life"; - } - } } } } diff --git a/Buffs/CalciumBuff.cs b/Buffs/CalciumBuff.cs new file mode 100644 index 0000000000..c40e98a54d --- /dev/null +++ b/Buffs/CalciumBuff.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class CalciumBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Calcium"); + Description.SetDefault("You are immune to fall damage"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).calcium = true; + } + } +} \ No newline at end of file diff --git a/Buffs/CalciumBuff.png b/Buffs/CalciumBuff.png new file mode 100644 index 0000000000..dc627f4c5b Binary files /dev/null and b/Buffs/CalciumBuff.png differ diff --git a/Buffs/CeaselessHunger.cs b/Buffs/CeaselessHunger.cs new file mode 100644 index 0000000000..173c730e03 --- /dev/null +++ b/Buffs/CeaselessHunger.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class CeaselessHunger : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Ceaseless Hunger"); + Description.SetDefault("You are sucking up all the items"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).ceaselessHunger = true; + } + } +} \ No newline at end of file diff --git a/Buffs/CeaselessHunger.png b/Buffs/CeaselessHunger.png new file mode 100644 index 0000000000..e073da8138 Binary files /dev/null and b/Buffs/CeaselessHunger.png differ diff --git a/Buffs/DraconicSurgeBuff.cs b/Buffs/DraconicSurgeBuff.cs new file mode 100644 index 0000000000..e85320e2df --- /dev/null +++ b/Buffs/DraconicSurgeBuff.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class DraconicSurgeBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Draconic Surge"); + Description.SetDefault("The power of a dragon courses through your veins"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).draconicSurge = true; + } + } +} \ No newline at end of file diff --git a/Buffs/DraconicSurgeBuff.png b/Buffs/DraconicSurgeBuff.png new file mode 100644 index 0000000000..450c156b90 Binary files /dev/null and b/Buffs/DraconicSurgeBuff.png differ diff --git a/Buffs/GazeOfCrysthamyrBuff.cs b/Buffs/GazeOfCrysthamyrBuff.cs new file mode 100644 index 0000000000..7f52c66f9f --- /dev/null +++ b/Buffs/GazeOfCrysthamyrBuff.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Buffs +{ + class GazeOfCrysthamyrBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Gaze of Crysthamyr"); + Description.SetDefault("You are riding a shadow dragon"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.mount.SetMount(mod.MountType(), player); + player.buffTime[buffIndex] = 10; + player.GetModPlayer(mod).crysthamyr = true; + } + } +} diff --git a/Buffs/GazeOfCrysthamyrBuff.png b/Buffs/GazeOfCrysthamyrBuff.png new file mode 100644 index 0000000000..a095d75534 Binary files /dev/null and b/Buffs/GazeOfCrysthamyrBuff.png differ diff --git a/Buffs/GravityNormalizerBuff.cs b/Buffs/GravityNormalizerBuff.cs new file mode 100644 index 0000000000..f28b533f8d --- /dev/null +++ b/Buffs/GravityNormalizerBuff.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class GravityNormalizerBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Gravity Normalizer"); + Description.SetDefault("Gravity is now normal in space, immunity to distorted"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).gravityNormalizer = true; + } + } +} \ No newline at end of file diff --git a/Buffs/GravityNormalizerBuff.png b/Buffs/GravityNormalizerBuff.png new file mode 100644 index 0000000000..ebeb4393ac Binary files /dev/null and b/Buffs/GravityNormalizerBuff.png differ diff --git a/Buffs/HolyWrathBuff.cs b/Buffs/HolyWrathBuff.cs new file mode 100644 index 0000000000..c4783053a5 --- /dev/null +++ b/Buffs/HolyWrathBuff.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class HolyWrathBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Holy Wrath"); + Description.SetDefault("Increased damage, increased movement and flight speed, and all attacks inflict holy fire"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).holyWrath = true; + } + } +} \ No newline at end of file diff --git a/Buffs/HolyWrathBuff.png b/Buffs/HolyWrathBuff.png new file mode 100644 index 0000000000..0a26701206 Binary files /dev/null and b/Buffs/HolyWrathBuff.png differ diff --git a/Buffs/Kendra.cs b/Buffs/Kendra.cs new file mode 100644 index 0000000000..3c61531d1b --- /dev/null +++ b/Buffs/Kendra.cs @@ -0,0 +1,30 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; + +namespace CalamityMod.Buffs +{ + public class Kendra : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Kendra"); + Description.SetDefault("A loyal friend accompanies you."); + Main.buffNoTimeDisplay[Type] = true; + Main.vanityPet[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.buffTime[buffIndex] = 18000; + player.GetModPlayer(mod).kendra = true; + bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Kendra")] <= 0; + if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer) + { + Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("Kendra"), 0, 0f, player.whoAmI, 0f, 0f); + } + } + } +} \ No newline at end of file diff --git a/Buffs/Kendra.png b/Buffs/Kendra.png new file mode 100644 index 0000000000..c6d766c509 Binary files /dev/null and b/Buffs/Kendra.png differ diff --git a/Buffs/Mushy.cs b/Buffs/Mushy.cs index 96a3e60371..b3e8f7d923 100644 --- a/Buffs/Mushy.cs +++ b/Buffs/Mushy.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Buffs public override void SetDefaults() { DisplayName.SetDefault("Mushy"); - Description.SetDefault("Increased defense by 10 and increased life regen by 5"); + Description.SetDefault("Increased defense and life regen by 5"); Main.buffNoTimeDisplay[Type] = true; Main.debuff[Type] = true; Main.pvpBuff[Type] = true; diff --git a/Buffs/PenumbraBuff.cs b/Buffs/PenumbraBuff.cs new file mode 100644 index 0000000000..fe12343aa0 --- /dev/null +++ b/Buffs/PenumbraBuff.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class PenumbraBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Penumbra"); + Description.SetDefault("Rogue stealth builds during nighttime and eclipse while moving"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).penumbra = true; + } + } +} \ No newline at end of file diff --git a/Buffs/PenumbraBuff.png b/Buffs/PenumbraBuff.png new file mode 100644 index 0000000000..fea7856dc9 Binary files /dev/null and b/Buffs/PenumbraBuff.png differ diff --git a/Buffs/PhotosynthesisBuff.cs b/Buffs/PhotosynthesisBuff.cs new file mode 100644 index 0000000000..f44c6a527e --- /dev/null +++ b/Buffs/PhotosynthesisBuff.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class PhotosynthesisBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Photosynthesis"); + Description.SetDefault("Life regen boosted, more during daytime, and hearts heal more HP"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).photosynthesis = true; + } + } +} \ No newline at end of file diff --git a/Buffs/PhotosynthesisBuff.png b/Buffs/PhotosynthesisBuff.png new file mode 100644 index 0000000000..9ce34e8e9a Binary files /dev/null and b/Buffs/PhotosynthesisBuff.png differ diff --git a/Buffs/ProfanedRageBuff.cs b/Buffs/ProfanedRageBuff.cs new file mode 100644 index 0000000000..cf7b60351c --- /dev/null +++ b/Buffs/ProfanedRageBuff.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class ProfanedRageBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Profaned Rage"); + Description.SetDefault("Increased crit chance, increased movement and flight speed, and you gain more rage when damaged"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).profanedRage = true; + } + } +} \ No newline at end of file diff --git a/Buffs/ProfanedRageBuff.png b/Buffs/ProfanedRageBuff.png new file mode 100644 index 0000000000..075804d8a7 Binary files /dev/null and b/Buffs/ProfanedRageBuff.png differ diff --git a/Buffs/Shrines/ChiBuff.cs b/Buffs/Shrines/ChiBuff.cs new file mode 100644 index 0000000000..ab2bab9746 --- /dev/null +++ b/Buffs/Shrines/ChiBuff.cs @@ -0,0 +1,28 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Shrines +{ + public class ChiBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Chi"); + Description.SetDefault("Your next attack is boosted and you are more resilient"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).trinketOfChiBuff = true; + } + } +} \ No newline at end of file diff --git a/Buffs/Shrines/ChiBuff.png b/Buffs/Shrines/ChiBuff.png new file mode 100644 index 0000000000..b74e1690af Binary files /dev/null and b/Buffs/Shrines/ChiBuff.png differ diff --git a/Buffs/Shrines/CorruptionEffigyBuff.cs b/Buffs/Shrines/CorruptionEffigyBuff.cs new file mode 100644 index 0000000000..94cda4af18 --- /dev/null +++ b/Buffs/Shrines/CorruptionEffigyBuff.cs @@ -0,0 +1,28 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Shrines +{ + public class CorruptionEffigyBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Corruption Effigy"); + Description.SetDefault("The corruption empowers you"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).corrEffigy = true; + } + } +} \ No newline at end of file diff --git a/Buffs/Shrines/CorruptionEffigyBuff.png b/Buffs/Shrines/CorruptionEffigyBuff.png new file mode 100644 index 0000000000..c4e47d8cc1 Binary files /dev/null and b/Buffs/Shrines/CorruptionEffigyBuff.png differ diff --git a/Buffs/Shrines/CrimsonEffigyBuff.cs b/Buffs/Shrines/CrimsonEffigyBuff.cs new file mode 100644 index 0000000000..68db53a47c --- /dev/null +++ b/Buffs/Shrines/CrimsonEffigyBuff.cs @@ -0,0 +1,28 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs.Shrines +{ + public class CrimsonEffigyBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Crimson Effigy"); + Description.SetDefault("The crimson empowers you"); + Main.buffNoTimeDisplay[Type] = true; + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).crimEffigy = true; + } + } +} \ No newline at end of file diff --git a/Buffs/Shrines/CrimsonEffigyBuff.png b/Buffs/Shrines/CrimsonEffigyBuff.png new file mode 100644 index 0000000000..0fdde912e0 Binary files /dev/null and b/Buffs/Shrines/CrimsonEffigyBuff.png differ diff --git a/Buffs/Shrines/GladiatorSwords.cs b/Buffs/Shrines/GladiatorSwords.cs new file mode 100644 index 0000000000..989c11edd9 --- /dev/null +++ b/Buffs/Shrines/GladiatorSwords.cs @@ -0,0 +1,34 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Shrines +{ + public class GladiatorSwords : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Gladiator Swords"); + Description.SetDefault("The gladiator swords will protect you"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.ownedProjectileCounts[mod.ProjectileType("GladiatorSword")] > 0) + { + modPlayer.glSword = true; + } + if (!modPlayer.glSword) + { + player.DelBuff(buffIndex); + buffIndex--; + } + else + { + player.buffTime[buffIndex] = 18000; + } + } + } +} \ No newline at end of file diff --git a/Buffs/Shrines/GladiatorSwords.png b/Buffs/Shrines/GladiatorSwords.png new file mode 100644 index 0000000000..c619aa09a5 Binary files /dev/null and b/Buffs/Shrines/GladiatorSwords.png differ diff --git a/Buffs/Shrines/OnyxExcavatorBuff.cs b/Buffs/Shrines/OnyxExcavatorBuff.cs new file mode 100644 index 0000000000..101c46e0d7 --- /dev/null +++ b/Buffs/Shrines/OnyxExcavatorBuff.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Buffs.Shrines +{ + class OnyxExcavatorBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Onyx Excavator"); + Description.SetDefault("Drill"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.mount.SetMount(mod.MountType(), player); + player.buffTime[buffIndex] = 10; + player.GetModPlayer(mod).onyxExcavator = true; + } + } +} diff --git a/Buffs/Shrines/OnyxExcavatorBuff.png b/Buffs/Shrines/OnyxExcavatorBuff.png new file mode 100644 index 0000000000..d87d9e6a60 Binary files /dev/null and b/Buffs/Shrines/OnyxExcavatorBuff.png differ diff --git a/Buffs/Shrines/TundraLeashBuff.cs b/Buffs/Shrines/TundraLeashBuff.cs new file mode 100644 index 0000000000..8cf7a08740 --- /dev/null +++ b/Buffs/Shrines/TundraLeashBuff.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Buffs.Shrines +{ + class TundraLeashBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Angry Dog"); + Description.SetDefault("You are riding an angry dog"); + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.mount.SetMount(mod.MountType(), player); + player.buffTime[buffIndex] = 10; + player.GetModPlayer(mod).angryDog = true; + } + } +} diff --git a/Buffs/Shrines/TundraLeashBuff.png b/Buffs/Shrines/TundraLeashBuff.png new file mode 100644 index 0000000000..7f0f429299 Binary files /dev/null and b/Buffs/Shrines/TundraLeashBuff.png differ diff --git a/Buffs/SirenBobsAlt.cs b/Buffs/SirenBobsAlt.cs index 46585d9285..7e5199c484 100644 --- a/Buffs/SirenBobsAlt.cs +++ b/Buffs/SirenBobsAlt.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Buffs { player.AddBuff(mod.BuffType("SirenWaterSpeed"), 360); } - } + } else { player.DelBuff(buffIndex); diff --git a/Buffs/Soaring.cs b/Buffs/Soaring.cs new file mode 100644 index 0000000000..e5e0ae9749 --- /dev/null +++ b/Buffs/Soaring.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class Soaring : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Soaring"); + Description.SetDefault("Increased wing flight time and speed"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).soaring = true; + } + } +} \ No newline at end of file diff --git a/Buffs/Soaring.png b/Buffs/Soaring.png new file mode 100644 index 0000000000..8c5d3de56b Binary files /dev/null and b/Buffs/Soaring.png differ diff --git a/Buffs/StrangeOrb.cs b/Buffs/StrangeOrb.cs index dad3805517..7aa0307677 100644 --- a/Buffs/StrangeOrb.cs +++ b/Buffs/StrangeOrb.cs @@ -26,6 +26,6 @@ namespace CalamityMod.Buffs { Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("SirenYoung"), 0, 0f, player.whoAmI, 0f, 0f); } - } + } } } \ No newline at end of file diff --git a/Buffs/TriumphBuff.cs b/Buffs/TriumphBuff.cs new file mode 100644 index 0000000000..2b3acc938b --- /dev/null +++ b/Buffs/TriumphBuff.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class TriumphBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Triumph"); + Description.SetDefault("Enemy contact damage is reduced, the lower their health the greater the reduction"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).triumph = true; + } + } +} \ No newline at end of file diff --git a/Buffs/TriumphBuff.png b/Buffs/TriumphBuff.png new file mode 100644 index 0000000000..0919b9b5df Binary files /dev/null and b/Buffs/TriumphBuff.png differ diff --git a/Buffs/WarCleave.cs b/Buffs/WarCleave.cs new file mode 100644 index 0000000000..becf240821 --- /dev/null +++ b/Buffs/WarCleave.cs @@ -0,0 +1,27 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod; +using CalamityMod.NPCs; + +namespace CalamityMod.Buffs +{ + public class WarCleave : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("War Cleave"); + Description.SetDefault("Defense and protection reduced"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.GetGlobalNPC(mod).wCleave = true; + } + } +} \ No newline at end of file diff --git a/Buffs/WarCleave.png b/Buffs/WarCleave.png new file mode 100644 index 0000000000..b2af246db2 Binary files /dev/null and b/Buffs/WarCleave.png differ diff --git a/CalamityLocalization.cs b/CalamityLocalization.cs index 944a63ddb4..49215f58b6 100644 --- a/CalamityLocalization.cs +++ b/CalamityLocalization.cs @@ -82,7 +82,6 @@ namespace CalamityMod new [] { "BloodMoonText", "The Blood Moon is rising..." }, new [] { "DargonBossText", "The dark sun awaits." }, new [] { "DargonBossText2", "My dragon deems you an unworthy opponent. You must acquire the power of the dark sun to witness his true power." }, - new [] { "DargonBossText3", "My dragon deems you an unworthy opponent. Snuff out the profaned flame and destroy the god devourer to witness his true power." }, new [] { "RevengeText", "Revengeance is active." }, new [] { "RevengeText2", "Revengeance is not active." }, new [] { "DeathText", "Death is active, enjoy the fun." }, @@ -113,7 +112,8 @@ namespace CalamityMod new [] { "SummonLevelUpFinal", "Summoner weapon proficiency maxed out!" }, new [] { "RogueLevelUp", "Rogue weapon proficiency level up!" }, new [] { "RogueLevelUpFinal", "Rogue weapon proficiency maxed out!" }, - new [] { "OpenSunkenSea", "The depths of the underground desert are rumbling..." } + new [] { "OpenSunkenSea", "The depths of the underground desert are rumbling..." }, + new [] { "AprilFools", "The LORDE is approaching..." } }; } diff --git a/CalamityMod.cs b/CalamityMod.cs index 2662fe62ee..291f38743b 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -66,6 +66,7 @@ namespace CalamityMod public static List projectileMinionList; public static List enemyImmunityList; public static List dungeonEnemyBuffList; + public static List dungeonProjectileBuffList; public static List bossScaleList; public static List beeEnemyList; public static List beeProjectileList; @@ -90,6 +91,8 @@ namespace CalamityMod public static List revengeanceProjectileBuffList; public static List trapProjectileList; public static List scopedWeaponList; + public static List trueMeleeBoostExceptionList; + public static List skeletonList; public static CalamityMod Instance; @@ -212,6 +215,7 @@ namespace CalamityMod projectileMinionList = null; enemyImmunityList = null; dungeonEnemyBuffList = null; + dungeonProjectileBuffList = null; bossScaleList = null; beeEnemyList = null; beeProjectileList = null; @@ -235,6 +239,8 @@ namespace CalamityMod revengeanceProjectileBuffList = null; trapProjectileList = null; scopedWeaponList = null; + trueMeleeBoostExceptionList = null; + skeletonList = null; BossHealthBarManager.Unload(); base.Unload(); @@ -304,7 +310,35 @@ namespace CalamityMod "Jenonen", "Dodu", "Arti", - "Tervastator" + "Tervastator", + "Luis Arguello", + "Alexander Davis", + "BakaQing", + "Laura Coonrod", + "Xaphlactus", + "MajinBagel", + "Bendy", + "Rando Calrissian", + "Tails the Fox 92", + "Bread", + "Minty Candy", + "Preston Card", + "MovingTarget_086", + "Shiro", + "Chip", + "Taylor Riverpaw", + "ShotgunAngel", + "Sandblast", + "ThomasThePencil", + "Aero (Aero#4599)", + "GlitchOut", + "Daawnz", + "CrabBar", + "Yatagarasu", + "Jarod Isaac Gordon", + "Zombieh", + "MingWhy", + "Random Weeb" }; rangedProjectileExceptionList = new List() @@ -313,6 +347,7 @@ namespace CalamityMod ProjectileID.VortexBeater, ProjectileID.DD2PhoenixBow, ProjectileID.IchorDart, + ProjectileID.PhantasmArrow, calamity.ProjectileType("Phangasm"), calamity.ProjectileType("Contagion"), calamity.ProjectileType("DaemonsFlame"), @@ -323,7 +358,10 @@ namespace CalamityMod calamity.ProjectileType("StarfleetMK2"), calamity.ProjectileType("TerraBulletSplit"), calamity.ProjectileType("TerraArrow2"), - calamity.ProjectileType("OMGWTH") + calamity.ProjectileType("OMGWTH"), + calamity.ProjectileType("Norfleet"), + calamity.ProjectileType("NorfleetComet"), + calamity.ProjectileType("NorfleetExplosion") }; projectileMinionList = new List() @@ -352,7 +390,16 @@ namespace CalamityMod enemyImmunityList = new List() { + NPCID.KingSlime, + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.BrainofCthulhu, + NPCID.Creeper, + NPCID.EyeofCthulhu, NPCID.QueenBee, + NPCID.SkeletronHead, + NPCID.SkeletronHand, NPCID.WallofFlesh, NPCID.WallofFleshEye, NPCID.Retinazer, @@ -407,6 +454,19 @@ namespace CalamityMod NPCID.RustyArmoredBonesAxe }; + dungeonProjectileBuffList = new List() + { + ProjectileID.PaladinsHammerHostile, + ProjectileID.ShadowBeamHostile, + ProjectileID.InfernoHostileBolt, + ProjectileID.InfernoHostileBlast, + ProjectileID.LostSoulHostile, + ProjectileID.SniperBullet, + ProjectileID.RocketSkeleton, + ProjectileID.BulletDeadeye, + ProjectileID.Shadowflames + }; + bossScaleList = new List() { NPCID.EaterofWorldsHead, @@ -744,7 +804,6 @@ namespace CalamityMod sixtySixDamageBuffList = new List() { - ItemID.TerraBlade, ItemID.TrueNightsEdge, ItemID.WandofSparking, ItemID.MedusaHead, @@ -769,6 +828,7 @@ namespace CalamityMod thirtyThreeDamageBuffList = new List() { + ItemID.TerraBlade, ItemID.CrystalVileShard, ItemID.SoulDrain, ItemID.ClingerStaff, @@ -783,7 +843,8 @@ namespace CalamityMod ItemID.YellowPhasesaber, ItemID.PurplePhasesaber, ItemID.TheRottedFork, - ItemID.VampireKnives + ItemID.VampireKnives, + ItemID.Cascade }; twentyFiveDamageBuffList = new List() @@ -838,6 +899,7 @@ namespace CalamityMod NPCID.MourningWood, NPCID.Splinterling, NPCID.Pumpking, + NPCID.PumpkingBlade, NPCID.Hellhound, NPCID.Poltergeist }; @@ -1146,7 +1208,6 @@ namespace CalamityMod calamity.ProjectileType("SirenSong"), calamity.ProjectileType("YharonFireball"), calamity.ProjectileType("YharonFireball2"), - calamity.ProjectileType("YharonFireballHoming"), calamity.ProjectileType("PearlBurst"), calamity.ProjectileType("PearlRain") }; @@ -1167,7 +1228,87 @@ namespace CalamityMod calamity.ItemType("AMR"), calamity.ItemType("Shroomer"), calamity.ItemType("SpectreRifle"), - calamity.ItemType("Svantechnical") + calamity.ItemType("Svantechnical"), + calamity.ItemType("Skullmasher") + }; + + trueMeleeBoostExceptionList = new List() + { + ItemID.FlowerPow, + ItemID.Flairon, + ItemID.ChlorophytePartisan, + ItemID.MushroomSpear, + ItemID.NorthPole, + ItemID.WoodYoyo, + ItemID.CorruptYoyo, + ItemID.CrimsonYoyo, + ItemID.JungleYoyo, + ItemID.Cascade, + ItemID.Chik, + ItemID.Code2, + ItemID.Rally, + ItemID.Yelets, + ItemID.RedsYoyo, + ItemID.ValkyrieYoyo, + ItemID.Amarok, + ItemID.HelFire, + ItemID.Kraken, + ItemID.TheEyeOfCthulhu, + ItemID.FormatC, + ItemID.Gradient, + ItemID.Valor, + ItemID.Terrarian, + calamity.ItemType("BallOFugu"), + calamity.ItemType("TyphonsGreed"), + calamity.ItemType("AmidiasTrident"), + calamity.ItemType("HellionFlowerSpear"), + calamity.ItemType("StarnightLance"), + calamity.ItemType("TerraLance"), + calamity.ItemType("BansheeHook"), + calamity.ItemType("SpatialLance"), + calamity.ItemType("StreamGouge"), + calamity.ItemType("AirSpinner"), + calamity.ItemType("Aorta"), + calamity.ItemType("Azathoth"), + calamity.ItemType("Chaotrix"), + calamity.ItemType("Cnidarian"), + calamity.ItemType("Lacerator"), + calamity.ItemType("Quagmire"), + calamity.ItemType("Shimmerspark"), + calamity.ItemType("SolarFlare"), + calamity.ItemType("TheEyeofCalamitas"), + calamity.ItemType("TheGodsGambit"), + calamity.ItemType("TheObliterator"), + calamity.ItemType("ThePlaguebringer"), + calamity.ItemType("Verdant"), + calamity.ItemType("YinYo") + }; + + skeletonList = new List() + { + NPCID.BigPantlessSkeleton, + NPCID.SmallPantlessSkeleton, + NPCID.BigMisassembledSkeleton, + NPCID.SmallMisassembledSkeleton, + NPCID.BigHeadacheSkeleton, + NPCID.SmallHeadacheSkeleton, + NPCID.BigSkeleton, + NPCID.SmallSkeleton, + NPCID.HeavySkeleton, + NPCID.Skeleton, + NPCID.ArmoredSkeleton, + NPCID.SkeletonArcher, + NPCID.HeadacheSkeleton, + NPCID.MisassembledSkeleton, + NPCID.PantlessSkeleton, + NPCID.SkeletonTopHat, + NPCID.SkeletonAstonaut, + NPCID.SkeletonAlien, + NPCID.BoneThrowingSkeleton, + NPCID.BoneThrowingSkeleton2, + NPCID.BoneThrowingSkeleton3, + NPCID.BoneThrowingSkeleton4, + NPCID.GreekSkeleton }; } } @@ -1181,14 +1322,6 @@ namespace CalamityMod { if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active) { - if (NPC.AnyNPCs(NPCID.CultistBoss)) - { - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Doomsayer"); - else - music = MusicID.Boss4; - priority = MusicPriority.BossMedium; - } if (Main.LocalPlayer.GetModPlayer(this).ZoneCalamity) { if (!CalamityPlayer.areThereAnyDamnBosses) @@ -1837,6 +1970,9 @@ namespace CalamityMod int type = reader.ReadInt32(); CalamityWorld.bossType = type; break; + case CalamityModMessageType.DeathCountSync: + Main.player[reader.ReadInt32()].GetModPlayer().HandleDeathCount(reader); + break; default: ErrorLogger.Log("CalamityMod: Unknown Message type: " + msgType); break; @@ -1871,6 +2007,7 @@ namespace CalamityMod BossRushStage, DoGCountdownSync, BossSpawnCountdownSync, - BossTypeSync + BossTypeSync, + DeathCountSync } } \ No newline at end of file diff --git a/CalamityPlayer.cs b/CalamityPlayer.cs index 3ba742f990..14e53c7520 100644 --- a/CalamityPlayer.cs +++ b/CalamityPlayer.cs @@ -34,20 +34,32 @@ namespace CalamityMod #region InstanceVars #region NormalVars - public float rogueStealth = 0f; + public static bool areThereAnyDamnBosses = false; - public float rogueStealthMax = 0f; + private const int saveVersion = 0; - public bool playRogueStealthSound = false; + public const float defEndurance = 0.33f; + + public int dashMod; + + public int dashTimeMod; + + public int projTypeJustHitBy; + + public int gainRageCooldown = 60; + + public int bossRushImmunityFrameCurseTimer = 0; + + public int aBulwarkRareMeleeBoostTimer = 0; + + public int ataraxiaDamageBoostCooldown = 0; + + public int ataraxiaDamageBoostCancelTimer = 1200; public int nebulaManaNerfCounter = 0; public int alcoholPoisonLevel = 0; - public static bool areThereAnyDamnBosses = false; - - private const int saveVersion = 0; - public int modStealthTimer; public int hInfernoBoost = 0; @@ -60,21 +72,25 @@ namespace CalamityMod public int sCalKillCount = 0; + public int deathCount = 0; + public int bloodflareHeartTimer = 180; public int bloodflareManaTimer = 180; + public float ataraxiaDamageBoost = 0f; + + public float rogueStealth = 0f; + + public float rogueStealthMax = 0f; + public float modStealth = 1f; public float aquaticBoost = 1f; public float shieldInvinc = 5f; - public int dashMod; - - public int dashTimeMod; - - public const float defEndurance = 0.33f; + public bool playRogueStealthSound = false; public bool playFullRageSound = true; @@ -84,17 +100,17 @@ namespace CalamityMod public bool playFullAdrenalineBurnoutSound = true; + public bool onyxExcavator = false; + + public bool angryDog = false; + public bool fab = false; + public bool crysthamyr = false; + public bool drawBossHPBar = true; public bool shouldDrawSmallText = true; - - public float ataraxiaDamageBoost = 0f; - - public int ataraxiaDamageBoostCooldown = 0; - - public int ataraxiaDamageBoostCancelTimer = 1200; #endregion #region ProficiencyStuff @@ -120,6 +136,8 @@ namespace CalamityMod #endregion #region PetStuff + public bool akato = false; + public bool leviPet = false; public bool sirenPet = false; @@ -132,6 +150,8 @@ namespace CalamityMod public bool bearPet = false; + public bool kendra = false; + public bool trashMan = false; public int trashManChest = -1; @@ -154,8 +174,6 @@ namespace CalamityMod public bool affliction = false; - public bool afflictedBuff = false; - public bool stressPills = false; public bool laudanum = false; @@ -213,6 +231,62 @@ namespace CalamityMod public bool adrenalineBoostThree = false; #endregion + #region LoreStuff + public bool desertScourgeLore = false; + + public bool eaterOfWorldsLore = false; + + public bool hiveMindLore = false; + + public bool perforatorLore = false; + + public bool queenBeeLore = false; + + public bool skeletronLore = false; + + public bool wallOfFleshLore = false; + + public bool destroyerLore = false; + + public bool aquaticScourgeLore = false; + + public bool skeletronPrimeLore = false; + + public bool brimstoneElementalLore = false; + + public bool calamitasLore = false; + + public bool planteraLore = false; + + public bool leviathanAndSirenLore = false; + + public bool astrumAureusLore = false; + + public bool astrumDeusLore = false; + + public bool golemLore = false; + + public bool plaguebringerGoliathLore = false; + + public bool dukeFishronLore = false; + + public bool ravagerLore = false; + + public bool lunaticCultistLore = false; + + public bool moonLordLore = false; + + public bool providenceLore = false; + + public bool polterghastLore = false; + + public bool DoGLore = false; + + public bool yharonLore = false; + + public bool SCalLore = false; + #endregion + #region AccessoryStuff public bool fasterMeleeLevel = false; @@ -224,6 +298,22 @@ namespace CalamityMod public bool fasterRogueLevel = false; + public bool luxorsGift = false; + + public bool fungalSymbiote = false; + + public bool trinketOfChi = false; + + public bool gladiatorSword = false; + + public bool unstablePrism = false; + + public bool regenator = false; + + public bool theBee = false; + + public int theBeeDamage = 0; + public bool rBrain = false; public bool bloodyWormTooth = false; @@ -238,6 +328,8 @@ namespace CalamityMod public bool badgeOfBravery = false; + public bool badgeOfBraveryRare = false; + public bool scarfCooldown = false; public bool cryogenSoul = false; @@ -256,6 +348,8 @@ namespace CalamityMod public bool nCore = false; + public bool deepDiver = false; + public bool abyssalDivingSuitPlates = false; public bool abyssalDivingSuitCooldown = false; @@ -270,8 +364,12 @@ namespace CalamityMod public bool aSpark = false; + public bool aSparkRare = false; + public bool aBulwark = false; + public bool aBulwarkRare = false; + public bool dAmulet = false; public bool fCarapace = false; @@ -320,6 +418,10 @@ namespace CalamityMod public bool projRef = false; + public bool projRefRare = false; + + public int projRefRareLifeRegenCounter = 0; + public bool nanotech = false; public bool eQuiver = false; @@ -383,6 +485,8 @@ namespace CalamityMod public bool giantPearl = false; public bool normalityRelocator = false; + + public bool fabledTortoise = false; #endregion #region ArmorSetStuff @@ -590,6 +694,14 @@ namespace CalamityMod #endregion #region BuffStuff + public bool trinketOfChiBuff = false; + + public int chiBuffTimer = 0; + + public bool corrEffigy = false; + + public bool crimEffigy = false; + public bool rRage = false; public bool tRegen = false; @@ -638,7 +750,37 @@ namespace CalamityMod public int revivifyTimer = 0; - public bool permafrostsConcoction; + public bool permafrostsConcoction = false; + + public bool armorCrumbling = false; + + public bool armorShattering = false; + + public bool ceaselessHunger = false; + + public bool calcium = false; + + public bool soaring = false; + + public bool bounding = false; + + public bool triumph = false; + + public bool penumbra = false; + + public bool photosynthesis = false; + + public bool astralInjection = false; + + public bool gravityNormalizer = false; + + public bool holyWrath = false; + + public bool profanedRage = false; + + public bool draconicSurge = false; + + public int draconicSurgeCooldown = 0; public bool vodka = false; @@ -698,6 +840,8 @@ namespace CalamityMod #endregion #region SummonStuff + public bool glSword = false; + public bool mWorm = false; public bool iClasper = false; @@ -961,6 +1105,9 @@ namespace CalamityMod }, { "exactRogueLevel", exactRogueLevel + }, + { + "deathCount", deathCount } }; } @@ -990,6 +1137,7 @@ namespace CalamityMod adrenaline = tag.GetInt("adrenaline"); sCalDeathCount = tag.GetInt("sCalDeathCount"); sCalKillCount = tag.GetInt("sCalKillCount"); + deathCount = tag.GetInt("deathCount"); meleeLevel = tag.GetInt("meleeLevel"); rangedLevel = tag.GetInt("rangedLevel"); @@ -1010,6 +1158,7 @@ namespace CalamityMod adrenaline = reader.ReadInt32(); sCalDeathCount = reader.ReadInt32(); sCalKillCount = reader.ReadInt32(); + deathCount = reader.ReadInt32(); meleeLevel = reader.ReadInt32(); rangedLevel = reader.ReadInt32(); @@ -1057,24 +1206,40 @@ namespace CalamityMod #region ResetEffects public override void ResetEffects() { + if (extraAccessoryML) + { + player.extraAccessorySlots = 1; + } if (extraAccessoryML && player.extraAccessory && (Main.expertMode || Main.gameMenu)) { player.extraAccessorySlots = 2; } + if (CalamityWorld.bossRushActive) + { + if (Config.BossRushAccessoryCurse) + { + player.extraAccessorySlots = 0; + } + } rogueStealthMax = 0f; dashMod = 0; alcoholPoisonLevel = 0; + akato = false; leviPet = false; sirenPet = false; fox = false; chibii = false; brimling = false; bearPet = false; + kendra = false; trashMan = false; + onyxExcavator = false; + angryDog = false; fab = false; + crysthamyr = false; abyssalDivingSuitPlates = false; abyssalDivingSuitCooldown = false; @@ -1088,7 +1253,6 @@ namespace CalamityMod afflicted = false; affliction = false; - afflictedBuff = false; fasterMeleeLevel = false; fasterRangedLevel = false; @@ -1142,14 +1306,53 @@ namespace CalamityMod shadowSpeed = false; dsSetBonus = false; + desertScourgeLore = false; + eaterOfWorldsLore = false; + hiveMindLore = false; + perforatorLore = false; + queenBeeLore = false; + skeletronLore = false; + wallOfFleshLore = false; + destroyerLore = false; + aquaticScourgeLore = false; + skeletronPrimeLore = false; + brimstoneElementalLore = false; + calamitasLore = false; + planteraLore = false; + leviathanAndSirenLore = false; + astrumAureusLore = false; + astrumDeusLore = false; + golemLore = false; + plaguebringerGoliathLore = false; + dukeFishronLore = false; + ravagerLore = false; + lunaticCultistLore = false; + moonLordLore = false; + providenceLore = false; + polterghastLore = false; + DoGLore = false; + yharonLore = false; + SCalLore = false; + + luxorsGift = false; + fungalSymbiote = false; + trinketOfChi = false; + gladiatorSword = false; + unstablePrism = false; + regenator = false; + deepDiver = false; + theBee = false; rBrain = false; bloodyWormTooth = false; rampartOfDeities = false; vexation = false; fBulwark = false; badgeOfBravery = false; + badgeOfBraveryRare = false; aSpark = false; + aSparkRare = false; aBulwark = false; + aBulwarkRare = false; dAmulet = false; fCarapace = false; gShell = false; @@ -1162,6 +1365,7 @@ namespace CalamityMod beeResist = false; uberBees = false; projRef = false; + projRefRare = false; nanotech = false; eQuiver = false; cryogenSoul = false; @@ -1193,6 +1397,7 @@ namespace CalamityMod pArtifact = false; giantPearl = false; normalityRelocator = false; + fabledTortoise = false; lol = false; raiderTalisman = false; sGenerator = false; @@ -1276,6 +1481,9 @@ namespace CalamityMod enraged = false; snowmanNoseless = false; + trinketOfChiBuff = false; + corrEffigy = false; + crimEffigy = false; rRage = false; xRage = false; xWrath = false; @@ -1287,6 +1495,35 @@ namespace CalamityMod zerg = false; zen = false; permafrostsConcoction = false; + armorCrumbling = false; + armorShattering = false; + ceaselessHunger = false; + calcium = false; + soaring = false; + bounding = false; + triumph = false; + penumbra = false; + photosynthesis = false; + astralInjection = false; + gravityNormalizer = false; + holyWrath = false; + profanedRage = false; + draconicSurge = false; + trippy = false; + amidiasBlessing = false; + yPower = false; + aWeapon = false; + tScale = false; + fabsolVodka = false; + invincible = false; + shine = false; + anechoicCoating = false; + mushy = false; + molten = false; + shellBoost = false; + cFreeze = false; + tRegen = false; + vodka = false; redWine = false; grapeBeer = false; @@ -1306,27 +1543,15 @@ namespace CalamityMod moscowMule = false; whiteWine = false; evergreenGin = false; + tranquilityCandle = false; chaosCandle = false; purpleCandle = false; blueCandle = false; pinkCandle = false; yellowCandle = false; - trippy = false; - amidiasBlessing = false; - yPower = false; - aWeapon = false; - tScale = false; - fabsolVodka = false; - invincible = false; - shine = false; - anechoicCoating = false; - mushy = false; - molten = false; - shellBoost = false; - cFreeze = false; - tRegen = false; + glSword = false; mWorm = false; iClasper = false; herring = false; @@ -1411,8 +1636,11 @@ namespace CalamityMod bloodflareMageCooldown = 0; tarraMageHealCooldown = 0; ataraxiaDamageBoost = 0f; + bossRushImmunityFrameCurseTimer = 0; + aBulwarkRareMeleeBoostTimer = 0; ataraxiaDamageBoostCooldown = 0; ataraxiaDamageBoostCancelTimer = 1200; + theBeeDamage = 0; lethalLavaBurn = false; aCrunch = false; hAttack = false; @@ -1447,11 +1675,17 @@ namespace CalamityMod sDefense = false; sRegen = false; sPower = false; + onyxExcavator = false; + angryDog = false; fab = false; + crysthamyr = false; abyssalDivingSuitPlates = false; sirenWaterBuff = false; sirenIce = false; - afflictedBuff = false; + trinketOfChiBuff = false; + chiBuffTimer = 0; + corrEffigy = false; + crimEffigy = false; rRage = false; xRage = false; xWrath = false; @@ -1462,6 +1696,22 @@ namespace CalamityMod omniscience = false; zerg = false; zen = false; + permafrostsConcoction = false; + armorCrumbling = false; + armorShattering = false; + ceaselessHunger = false; + calcium = false; + soaring = false; + bounding = false; + triumph = false; + penumbra = false; + photosynthesis = false; + astralInjection = false; + gravityNormalizer = false; + holyWrath = false; + profanedRage = false; + draconicSurge = false; + draconicSurgeCooldown = 0; yPower = false; aWeapon = false; tScale = false; @@ -1821,7 +2071,7 @@ namespace CalamityMod player.lifeRegenTime = 0; player.lifeRegen -= 30; } - if (ZoneSulphur && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + if (ZoneSulphur && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && !aquaticScourgeLore) { player.AddBuff(BuffID.Poisoned, 2, true); pissWaterBoost++; @@ -1913,7 +2163,6 @@ namespace CalamityMod player.blind = true; player.statDefense -= 30; player.moveSpeed -= 0.1f; - player.endurance -= 0.3f; if (player.wingTimeMax <= 0) { player.wingTimeMax = 0; @@ -2095,37 +2344,40 @@ namespace CalamityMod if (player.lifeRegenCount > 0) player.lifeRegenCount = 0; } - if (Main.myPlayer == player.whoAmI && CalamityWorld.revenge) + if (Config.LethalLava) { - if (Collision.LavaCollision(player.position, player.width, (player.waterWalk ? (player.height - 6) : player.height))) + if (Main.myPlayer == player.whoAmI) { - if (player.lavaImmune && !player.immune) + if (Collision.LavaCollision(player.position, player.width, (player.waterWalk ? (player.height - 6) : player.height))) { - if (player.lavaTime > 0) + if (player.lavaImmune && !player.immune) { - player.lavaTime--; + if (player.lavaTime > 0) + { + player.lavaTime--; + } + } + if (player.lavaTime <= 0) + { + player.AddBuff(mod.BuffType("LethalLavaBurn"), 2, true); } } - if (player.lavaTime <= 0) + } + if (lethalLavaBurn) + { + if (player.lifeRegen > 0) { - player.AddBuff(mod.BuffType("LethalLavaBurn"), 2, true); + player.lifeRegen = 0; } + player.lifeRegenTime = 0; + int lifeRegenDown = (player.lavaImmune ? 9 : 18); + if (player.lavaRose) + { + lifeRegenDown = 3; + } + player.lifeRegen -= lifeRegenDown; } } - if (lethalLavaBurn) - { - if (player.lifeRegen > 0) - { - player.lifeRegen = 0; - } - player.lifeRegenTime = 0; - int lifeRegenDown = (player.lavaImmune ? 9 : 18); - if (player.lavaRose) - { - lifeRegenDown = 3; - } - player.lifeRegen -= lifeRegenDown; - } if (hInferno) { hInfernoBoost++; @@ -2195,6 +2447,10 @@ namespace CalamityMod { player.velocity.X *= 0.99f; } + if (molluskSet) + { + player.velocity.X *= 0.985f; + } if ((warped || caribbeanRum) && !player.slowFall) { player.velocity.Y *= 1.01f; @@ -2202,16 +2458,12 @@ namespace CalamityMod if (weakPetrification || CalamityWorld.bossRushActive) { if (player.mount.Active) - { player.mount.Dismount(player); - } } if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) { if (player.lifeRegen < 0) - { player.lifeRegen = 0; - } } #endregion } @@ -2224,117 +2476,157 @@ namespace CalamityMod int lifeRegenTimeMaxBoost = (areThereAnyDamnBosses ? 450 : 1800); int lifeRegenMaxBoost = (areThereAnyDamnBosses ? 1 : 4); float lifeRegenLifeRegenTimeMaxBoost = (areThereAnyDamnBosses ? 8f : 30f); - if (draedonsHeart && !shadeRegen && !cFreeze && - (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) + if (shadeRegen) { - player.lifeRegenTime = lifeRegenTimeMaxBoost; - } - player.lifeRegenTime += lifeRegenMaxBoost; - player.lifeRegen += lifeRegenMaxBoost; - float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost) + if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) { - num3 = lifeRegenLifeRegenTimeMaxBoost; + player.lifeRegenTime = lifeRegenTimeMaxBoost; } - player.lifeRegen += (int)num3; - } - if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) - { - player.lifeRegenCount++; - if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.Next(2) == 0)) + player.lifeRegenTime += lifeRegenMaxBoost; + player.lifeRegen += lifeRegenMaxBoost; + float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 + num3 /= 300f; + if (num3 > 0f) { - int num5 = Dust.NewDust(player.position, player.width, player.height, 107, 0f, 0f, 200, default(Color), 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; + if (num3 > lifeRegenLifeRegenTimeMaxBoost) + { + num3 = lifeRegenLifeRegenTimeMaxBoost; + } + player.lifeRegen += (int)num3; + } + if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) + { + player.lifeRegenCount++; + if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.Next(30) == 0)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 173, 0f, 0f, 200, default(Color), 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } } } - } - if (shadeRegen && !draedonsHeart && !cFreeze && - (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) + else if (cFreeze) { - player.lifeRegenTime = lifeRegenTimeMaxBoost; - } - player.lifeRegenTime += lifeRegenMaxBoost; - player.lifeRegen += lifeRegenMaxBoost; - float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost) + if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) { - num3 = lifeRegenLifeRegenTimeMaxBoost; + player.lifeRegenTime = lifeRegenTimeMaxBoost; } - player.lifeRegen += (int)num3; - } - if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) - { - player.lifeRegenCount++; - if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.Next(30) == 0)) + player.lifeRegenTime += lifeRegenMaxBoost; + player.lifeRegen += lifeRegenMaxBoost; + float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 + num3 /= 300f; + if (num3 > 0f) { - int num5 = Dust.NewDust(player.position, player.width, player.height, 173, 0f, 0f, 200, default(Color), 1f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; + if (num3 > lifeRegenLifeRegenTimeMaxBoost) + { + num3 = lifeRegenLifeRegenTimeMaxBoost; + } + player.lifeRegen += (int)num3; + } + if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) + { + player.lifeRegenCount++; + if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.Next(30) == 0)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 0.75f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } } } - } - if (cFreeze && !shadeRegen && !draedonsHeart && - (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) + else if (draedonsHeart) { - player.lifeRegenTime = lifeRegenTimeMaxBoost; - } - player.lifeRegenTime += lifeRegenMaxBoost; - player.lifeRegen += lifeRegenMaxBoost; - float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 - num3 /= 300f; - if (num3 > 0f) - { - if (num3 > lifeRegenLifeRegenTimeMaxBoost) + if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost) { - num3 = lifeRegenLifeRegenTimeMaxBoost; + player.lifeRegenTime = lifeRegenTimeMaxBoost; } - player.lifeRegen += (int)num3; - } - if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) - { - player.lifeRegenCount++; - if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.Next(30) == 0)) + player.lifeRegenTime += lifeRegenMaxBoost; + player.lifeRegen += lifeRegenMaxBoost; + float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 + num3 /= 300f; + if (num3 > 0f) { - int num5 = Dust.NewDust(player.position, player.width, player.height, 67, 0f, 0f, 200, new Color(150, Main.DiscoG, 255), 0.75f); - Main.dust[num5].noGravity = true; - Main.dust[num5].velocity *= 0.75f; - Main.dust[num5].fadeIn = 1.3f; - Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - vector.Normalize(); - vector *= (float)Main.rand.Next(50, 100) * 0.04f; - Main.dust[num5].velocity = vector; - vector.Normalize(); - vector *= 34f; - Main.dust[num5].position = player.Center - vector; + if (num3 > lifeRegenLifeRegenTimeMaxBoost) + { + num3 = lifeRegenLifeRegenTimeMaxBoost; + } + player.lifeRegen += (int)num3; + } + if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) + { + player.lifeRegenCount++; + if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.Next(2) == 0)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 107, 0f, 0f, 200, default(Color), 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } + } + } + else if (photosynthesis) + { + int lifeRegenTimeMaxBoost2 = Main.dayTime ? lifeRegenTimeMaxBoost : (lifeRegenTimeMaxBoost / 5); + int lifeRegenMaxBoost2 = Main.dayTime ? lifeRegenMaxBoost : (lifeRegenMaxBoost / 5); + float lifeRegenLifeRegenTimeMaxBoost2 = Main.dayTime ? lifeRegenLifeRegenTimeMaxBoost : (lifeRegenLifeRegenTimeMaxBoost / 5); + if (player.lifeRegenTime > 90 && player.lifeRegenTime < lifeRegenTimeMaxBoost2) + { + player.lifeRegenTime = lifeRegenTimeMaxBoost2; + } + player.lifeRegenTime += lifeRegenMaxBoost2; + player.lifeRegen += lifeRegenMaxBoost2; + float num3 = (float)((double)player.lifeRegenTime * 2.5); //lifeRegenTime max is 3600 + num3 /= 300f; + if (num3 > 0f) + { + if (num3 > lifeRegenLifeRegenTimeMaxBoost2) + { + num3 = lifeRegenLifeRegenTimeMaxBoost2; + } + player.lifeRegen += (int)num3; + } + if (player.lifeRegen > 0 && player.statLife < player.statLifeMax2) + { + player.lifeRegenCount++; + if ((Main.rand.Next(30000) < player.lifeRegenTime || Main.rand.Next(2) == 0)) + { + int num5 = Dust.NewDust(player.position, player.width, player.height, 244, 0f, 0f, 200, default(Color), 1f); + Main.dust[num5].noGravity = true; + Main.dust[num5].velocity *= 0.75f; + Main.dust[num5].fadeIn = 1.3f; + Vector2 vector = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + vector.Normalize(); + vector *= (float)Main.rand.Next(50, 100) * 0.04f; + Main.dust[num5].velocity = vector; + vector.Normalize(); + vector *= 34f; + Main.dust[num5].position = player.Center - vector; + } } } } @@ -2905,12 +3197,16 @@ namespace CalamityMod } if (darkSunRing) { - meleeSpeedMult += 0.1f; + meleeSpeedMult += 0.12f; } if (badgeOfBravery) { meleeSpeedMult += 0.15f; } + if (badgeOfBraveryRare) + { + meleeSpeedMult += 0.2f; + } if (eGauntlet) { meleeSpeedMult += 0.15f; @@ -3017,7 +3313,9 @@ namespace CalamityMod } #endregion - #region PostUpdateEffects + #region PostUpdate + + #region PostUpdateBuffs public override void PostUpdateBuffs() { if (NOU) @@ -3029,7 +3327,10 @@ namespace CalamityMod if (weakPetrification) WeakPetrification(); - if (player.mount.Active || player.mount.Cart) + if (CalamityWorld.bossRushActive) + BossRushMovementChanges(); + + if (player.mount.Active || player.mount.Cart || (Config.BossRushDashCurse && CalamityWorld.bossRushActive)) { player.dashDelay = 60; dashMod = 0; @@ -3041,7 +3342,9 @@ namespace CalamityMod player.lifeRegen = 0; } } + #endregion + #region PostUpdateEquips public override void PostUpdateEquips() { if (NOU) @@ -3053,7 +3356,10 @@ namespace CalamityMod if (weakPetrification) WeakPetrification(); - if (player.mount.Active || player.mount.Cart) + if (CalamityWorld.bossRushActive) + BossRushMovementChanges(); + + if (player.mount.Active || player.mount.Cart || (Config.BossRushDashCurse && CalamityWorld.bossRushActive)) { player.dashDelay = 60; dashMod = 0; @@ -3065,13 +3371,13 @@ namespace CalamityMod player.lifeRegen = 0; } } + #endregion public override void PostUpdateMiscEffects() { if (Config.ExpertDebuffDurationReduction) - { Main.expertDebuffTime = 1f; - } + areThereAnyDamnBosses = CalamityGlobalNPC.AnyBossNPCS(); #region RevengeanceEffects @@ -3302,7 +3608,7 @@ namespace CalamityMod } player.statLifeMax2 += player.statLifeMax / 5 / 20 * 5; } - if (affliction) + if (affliction || afflicted) { player.lifeRegen += 1; player.endurance += CalamityWorld.revenge ? 0.07f : 0.05f; @@ -3311,16 +3617,6 @@ namespace CalamityMod AllDamageBoost(damageBoost); player.statLifeMax2 += CalamityWorld.revenge ? (player.statLifeMax / 5 / 20 * 10) : (player.statLifeMax / 5 / 20 * 5); } - else if (afflicted) - { - player.lifeRegen += 1; - player.endurance += CalamityWorld.revenge ? 0.07f : 0.05f; - player.statDefense += CalamityWorld.revenge ? 20 : 15; - float damageBoost = CalamityWorld.revenge ? 0.12f : 0.1f; - AllDamageBoost(damageBoost); - player.statLifeMax2 += CalamityWorld.revenge ? (player.statLifeMax / 5 / 20 * 10) : (player.statLifeMax / 5 / 20 * 5); - } - if (afflictedBuff) { afflicted = true; } #endregion #region MaxLifeAndManaBoosts @@ -3332,9 +3628,15 @@ namespace CalamityMod if (silvaHitCounter > 0) { player.statLifeMax2 -= silvaHitCounter * 100; - if (player.statLifeMax2 < 200) + if (player.statLifeMax2 <= 400) { - player.statLifeMax2 = 200; + player.statLifeMax2 = 400; + if (silvaCountdown > 0) + { + if (player.FindBuffIndex(mod.BuffType("SilvaRevival")) > -1) { player.ClearBuff(mod.BuffType("SilvaRevival")); } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaDispel"), (int)player.position.X, (int)player.position.Y); + } + silvaCountdown = 0; } } player.statManaMax2 += @@ -3384,6 +3686,10 @@ namespace CalamityMod { GetExactLevelUp(); } + + if (gainRageCooldown > 0) + gainRageCooldown--; + if (player.nebulaLevelMana > 0 && player.statMana < player.statManaMax2) { int num = 12; @@ -3444,7 +3750,12 @@ namespace CalamityMod } if (silvaSet || invincible || margarita) { - foreach (int debuff in CalamityMod.debuffList) { player.buffImmune[debuff] = true; } + foreach (int debuff in CalamityMod.debuffList) + player.buffImmune[debuff] = true; + } + if (aSparkRare) + { + player.buffImmune[BuffID.Electrified] = true; } if (Config.ExpertChilledWaterRemoval) { @@ -3463,10 +3774,14 @@ namespace CalamityMod } if (ZoneAbyss) { - if (abyssalAmulet) { player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * (lumenousAmulet ? 25 : 10); } + if (abyssalAmulet) + { + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * (lumenousAmulet ? 25 : 10); + } if (Main.myPlayer == player.whoAmI) //4200 total tiles small world { int breathLoss = 2; + int lifeLossAtZeroBreath = 3; int lightStrength = 0 + ((player.lightOrb || player.crimsonHeart || player.magicLantern) ? 1 : 0) + //1 (aquaticEmblem ? 1 : 0) + //2 @@ -3482,29 +3797,40 @@ namespace CalamityMod if (ZoneAbyssLayer4) //3200 and below { breathLoss = 54; - if (!lightLevelFour) { player.blind = true; } - if (!lightLevelThree) { player.headcovered = true; } - if (!depthCharm) { player.bleed = true; } + if (!lightLevelFour) + player.blind = true; + if (!lightLevelThree) + player.headcovered = true; + player.bleed = true; + lifeLossAtZeroBreath = 24; player.statDefense -= (anechoicPlating ? 40 : 120); } else if (ZoneAbyssLayer3) //2700 to 3200 { breathLoss = 18; - if (!lightLevelThree) { player.blind = true; } - if (!lightLevelTwo) { player.headcovered = true; } - if (!depthCharm) { player.bleed = true; } + if (!lightLevelThree) + player.blind = true; + if (!lightLevelTwo) + player.headcovered = true; + if (!abyssalDivingSuit) + player.bleed = true; + lifeLossAtZeroBreath = 12; player.statDefense -= (anechoicPlating ? 20 : 60); } else if (ZoneAbyssLayer2) //2100 to 2700 { breathLoss = 6; - if (!lightLevelTwo) { player.blind = true; } - if (!depthCharm) { player.bleed = true; } + if (!lightLevelTwo) + player.blind = true; + if (!depthCharm) + player.bleed = true; + lifeLossAtZeroBreath = 6; player.statDefense -= (anechoicPlating ? 10 : 30); } else if (ZoneAbyssLayer1) //1500 to 2100 { - if (!lightLevelOne) { player.blind = true; } + if (!lightLevelOne) + player.blind = true; player.statDefense -= (anechoicPlating ? 5 : 15); } double breathLossMult = 1.0 - @@ -3516,7 +3842,10 @@ namespace CalamityMod (victideSet ? 0.2 : 0.0) - //0.85 (((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) ? 0.3 : 0.0) - //0.7 (abyssalDivingSuit ? 0.3 : 0.0); //0.7 - if (breathLossMult < 0.05) { breathLossMult = 0.05; } + if (breathLossMult < 0.05) + { + breathLossMult = 0.05; + } breathLoss = (int)((double)breathLoss * breathLossMult); int tick = 6; double tickMult = 1.0 + @@ -3529,7 +3858,10 @@ namespace CalamityMod (victideSet ? 5.0 : 0.0) + //60 (((sirenBoobs || sirenBoobsAlt) && NPC.downedBoss3) ? 15.0 : 0.0) + //75 (abyssalDivingSuit ? 15.0 : 0.0); //90 - if (tickMult > 50.0) { tickMult = 50.0; } + if (tickMult > 50.0) + { + tickMult = 50.0; + } tick = (int)((double)tick * tickMult); abyssBreathCD++; if (player.gills || player.merman) @@ -3561,10 +3893,17 @@ namespace CalamityMod } if (player.breath <= 0) { - int lifeLoss = 6 + - (player.bleed ? 6 : 0) - - (depthCharm ? 3 : 0); - player.statLife -= lifeLoss; + if (depthCharm) + { + lifeLossAtZeroBreath -= 3; + if (abyssalDivingSuit) + lifeLossAtZeroBreath -= 6; + } + if (lifeLossAtZeroBreath < 0) + { + lifeLossAtZeroBreath = 0; + } + player.statLife -= lifeLossAtZeroBreath; if (player.statLife <= 0) { KillPlayer(); @@ -3582,6 +3921,17 @@ namespace CalamityMod { player.maxFallSpeed = 15f; } + if (player.ZoneSkyHeight) + { + if (astrumDeusLore) + { + player.moveSpeed += 0.3f; + } + if (astrumAureusLore) + { + player.jumpSpeedBoost += 0.5f; + } + } if (omegaBlueSet) //should apply after rev caps, actually those are gone so AAAAA { //add tentacles @@ -3623,7 +3973,10 @@ namespace CalamityMod { if (gHealer) { - if (healCounter > 0) { healCounter--; } + if (healCounter > 0) + { + healCounter--; + } if (healCounter <= 0) { healCounter = 300; @@ -3651,14 +4004,34 @@ namespace CalamityMod player.maxMinions++; } } - if (revivifyTimer > 0) { revivifyTimer--; } - if (fleshTotemCooldown > 0) { fleshTotemCooldown--; } - if (astralStarRainCooldown > 0) { astralStarRainCooldown--; } - if (bloodflareMageCooldown > 0) { bloodflareMageCooldown--; } - if (tarraMageHealCooldown > 0) { tarraMageHealCooldown--; } - if (ataxiaDmg > 0) { ataxiaDmg--; } - if (xerocDmg > 0) { xerocDmg--; } - if (godSlayerDmg > 0) { godSlayerDmg--; } + if (draconicSurgeCooldown > 0) + draconicSurgeCooldown--; + if (revivifyTimer > 0) + revivifyTimer--; + if (fleshTotemCooldown > 0) + fleshTotemCooldown--; + if (astralStarRainCooldown > 0) + astralStarRainCooldown--; + if (bloodflareMageCooldown > 0) + bloodflareMageCooldown--; + if (tarraMageHealCooldown > 0) + tarraMageHealCooldown--; + if (ataxiaDmg > 0f) + ataxiaDmg -= 1.5f; + if (ataxiaDmg < 0f) + ataxiaDmg = 0f; + if (xerocDmg > 0f) + xerocDmg -= 2f; + if (xerocDmg < 0f) + xerocDmg = 0f; + if (godSlayerDmg > 0f) + godSlayerDmg -= 2.5f; + if (godSlayerDmg < 0f) + godSlayerDmg = 0f; + if (aBulwarkRareMeleeBoostTimer > 0) + aBulwarkRareMeleeBoostTimer--; + if (bossRushImmunityFrameCurseTimer > 0) + bossRushImmunityFrameCurseTimer--; if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) { player.buffImmune[mod.BuffType("VulnerabilityHex")] = true; @@ -3712,11 +4085,15 @@ namespace CalamityMod } } } - if (tarraCooldown > 0) { tarraCooldown--; } + if (tarraCooldown > 0) + tarraCooldown--; } if (tarraThrowing) { - if (tarraThrowingCritTimer > 0) { tarraThrowingCritTimer--; } + if (tarraThrowingCritTimer > 0) + { + tarraThrowingCritTimer--; + } if (tarraThrowingCrits >= 25) { tarraThrowingCrits = 0; @@ -3736,8 +4113,10 @@ namespace CalamityMod } if (bloodflareSet) { - if (bloodflareHeartTimer > 0) { bloodflareHeartTimer--; } - if (bloodflareManaTimer > 0) { bloodflareManaTimer--; } + if (bloodflareHeartTimer > 0) + bloodflareHeartTimer--; + if (bloodflareManaTimer > 0) + bloodflareManaTimer--; } if (bloodflareMelee) { @@ -3772,17 +4151,23 @@ namespace CalamityMod } } } - if (bloodflareFrenzyCooldown > 0) { bloodflareFrenzyCooldown--; } + if (bloodflareFrenzyCooldown > 0) + bloodflareFrenzyCooldown--; } if (bloodflareRanged) { - if (bloodflareRangedCooldown > 0) { bloodflareRangedCooldown--; } + if (bloodflareRangedCooldown > 0) + bloodflareRangedCooldown--; } if (Main.raining && ZoneSulphur) { - if (player.ZoneOverworldHeight || player.ZoneSkyHeight) { player.AddBuff(mod.BuffType("Irradiated"), 2); } + if (player.ZoneOverworldHeight || player.ZoneSkyHeight) + player.AddBuff(mod.BuffType("Irradiated"), 2); + } + if (raiderTalisman) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += ((float)raiderStack / 250f) * 0.25f; } - if (raiderTalisman) { CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += ((float)raiderStack / 250f) * 0.15f; } if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon) { player.maxMinions += 2; @@ -3811,13 +4196,19 @@ namespace CalamityMod player.moveSpeed += 0.2f; } } - if (coreOfTheBloodGod) { player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 10; } - if (bloodPact) { player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 100; } + if (coreOfTheBloodGod) + { + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 10; + } + if (bloodPact) + { + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 100; + } if (aAmpoule) { Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1f, 1f, 0.6f); player.endurance += 0.05f; - player.pickSpeed -= 0.5f; + player.pickSpeed -= 0.25f; player.buffImmune[70] = true; player.buffImmune[47] = true; player.buffImmune[46] = true; @@ -3904,6 +4295,270 @@ namespace CalamityMod if (ataraxiaDamageBoost > 0.3f) ataraxiaDamageBoost = 0.3f; } + if (projRefRareLifeRegenCounter > 0) + { + projRefRareLifeRegenCounter--; + player.lifeRegenTime += 2; + player.lifeRegen += 2; + } + if (desertScourgeLore) + { + player.statDefense += 10; + } + if (skeletronPrimeLore) + { + player.armorPenetration += 5; + } + if (destroyerLore) + { + player.pickSpeed -= 0.1f; + } + if (golemLore) + { + if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) + { + player.statDefense += 10; + } + } + if (aquaticScourgeLore && player.wellFed) + { + player.statDefense += 1; + player.meleeCrit += 1; + player.meleeDamage += 0.025f; + player.meleeSpeed += 0.025f; + player.magicCrit += 1; + player.magicDamage += 0.025f; + player.rangedCrit += 1; + player.rangedDamage += 0.025f; + player.thrownCrit += 1; + player.thrownDamage += 0.025f; + player.minionDamage += 0.025f; + player.minionKB += 0.25f; + player.moveSpeed += 0.1f; + } + if (eaterOfWorldsLore) + { + int damage = 20; + float knockBack = 2f; + if (Main.rand.Next(15) == 0) + { + int num = 0; + for (int i = 0; i < 1000; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].type == mod.ProjectileType("TheDeadlyMicrobeProjectile")) + { + num++; + } + } + if (Main.rand.Next(15) >= num && num < 6) + { + int num2 = 50; + int num3 = 24; + int num4 = 90; + for (int j = 0; j < num2; j++) + { + int num5 = Main.rand.Next(200 - j * 2, 400 + j * 2); + Vector2 center = player.Center; + center.X += (float)Main.rand.Next(-num5, num5 + 1); + center.Y += (float)Main.rand.Next(-num5, num5 + 1); + if (!Collision.SolidCollision(center, num3, num3) && !Collision.WetCollision(center, num3, num3)) + { + center.X += (float)(num3 / 2); + center.Y += (float)(num3 / 2); + if (Collision.CanHit(new Vector2(player.Center.X, player.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(player.Center.X, player.position.Y - 50f), 1, 1, center, 1, 1)) + { + int num6 = (int)center.X / 16; + int num7 = (int)center.Y / 16; + bool flag = false; + if (Main.rand.Next(3) == 0 && Main.tile[num6, num7] != null && Main.tile[num6, num7].wall > 0) + { + flag = true; + } + else + { + center.X -= (float)(num4 / 2); + center.Y -= (float)(num4 / 2); + if (Collision.SolidCollision(center, num4, num4)) + { + center.X += (float)(num4 / 2); + center.Y += (float)(num4 / 2); + flag = true; + } + } + if (flag) + { + for (int k = 0; k < 1000; k++) + { + if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == mod.ProjectileType("TheDeadlyMicrobeProjectile") && (center - Main.projectile[k].Center).Length() < 48f) + { + flag = false; + break; + } + } + if (flag && Main.myPlayer == player.whoAmI) + { + Projectile.NewProjectile(center.X, center.Y, 0f, 0f, mod.ProjectileType("TheDeadlyMicrobeProjectile"), damage, knockBack, player.whoAmI, 0f, 0f); + } + } + } + } + } + } + } + } + if (calcium) + { + player.noFallDmg = true; + } + if (skeletronLore) + { + AllDamageBoost(0.05f); + AllCritBoost(5); + player.statDefense += 10; + } + if (ceaselessHunger) + { + for (int j = 0; j < 400; j++) + { + if (Main.item[j].active && Main.item[j].noGrabDelay == 0 && Main.item[j].owner == player.whoAmI) + { + int num = Main.maxTilesX; + if (new Rectangle((int)player.position.X - num, (int)player.position.Y - num, player.width + num * 2, player.height + num * 2).Intersects(new Rectangle((int)Main.item[j].position.X, (int)Main.item[j].position.Y, Main.item[j].width, Main.item[j].height))) + { + Main.item[j].beingGrabbed = true; + if ((double)player.position.X + (double)player.width * 0.5 > (double)Main.item[j].position.X + (double)Main.item[j].width * 0.5) + { + if (Main.item[j].velocity.X < 40f + player.velocity.X) + { + Item item = Main.item[j]; + item.velocity.X = item.velocity.X + 4.5f; + } + if (Main.item[j].velocity.X < 0f) + { + Item item = Main.item[j]; + item.velocity.X = item.velocity.X + 4.5f * 0.75f; + } + } + else + { + if (Main.item[j].velocity.X > -40f + player.velocity.X) + { + Item item = Main.item[j]; + item.velocity.X = item.velocity.X - 4.5f; + } + if (Main.item[j].velocity.X > 0f) + { + Item item = Main.item[j]; + item.velocity.X = item.velocity.X - 4.5f * 0.75f; + } + } + if ((double)player.position.Y + (double)player.height * 0.5 > (double)Main.item[j].position.Y + (double)Main.item[j].height * 0.5) + { + if (Main.item[j].velocity.Y < 40f) + { + Item item = Main.item[j]; + item.velocity.Y = item.velocity.Y + 4.5f; + } + if (Main.item[j].velocity.Y < 0f) + { + Item item = Main.item[j]; + item.velocity.Y = item.velocity.Y + 4.5f * 0.75f; + } + } + else + { + if (Main.item[j].velocity.Y > -40f) + { + Item item = Main.item[j]; + item.velocity.Y = item.velocity.Y - 4.5f; + } + if (Main.item[j].velocity.Y > 0f) + { + Item item = Main.item[j]; + item.velocity.Y = item.velocity.Y - 4.5f * 0.75f; + } + } + } + } + } + } + if (dukeFishronLore) + { + AllDamageBoost(0.05f); + AllCritBoost(5); + player.moveSpeed += 0.15f; + } + if (lunaticCultistLore) + { + player.endurance += 0.04f; + player.statDefense += 4; + AllDamageBoost(0.04f); + AllCritBoost(4); + player.minionKB += 0.5f; + player.moveSpeed += 0.1f; + } + if (moonLordLore) + { + if (player.gravDir == -1f && player.gravControl2) + { + player.endurance += 0.05f; + player.statDefense += 10; + AllDamageBoost(0.1f); + AllCritBoost(10); + player.minionKB += 1.5f; + player.moveSpeed += 0.15f; + } + } + if (leviathanAndSirenLore) + { + if (sirenBoobsPrevious || sirenBoobsAltPrevious) + { + player.statLifeMax2 += player.statLifeMax2 / 5 / 20 * 5; + } + if (sirenPet) + { + player.spelunkerTimer += 1; + if (player.spelunkerTimer >= 10) + { + player.spelunkerTimer = 0; + int num65 = 30; + int num66 = (int)player.Center.X / 16; + int num67 = (int)player.Center.Y / 16; + for (int num68 = num66 - num65; num68 <= num66 + num65; num68++) + { + for (int num69 = num67 - num65; num69 <= num67 + num65; num69++) + { + if (Main.rand.Next(4) == 0) + { + Vector2 vector = new Vector2((float)(num66 - num68), (float)(num67 - num69)); + if (vector.Length() < (float)num65 && num68 > 0 && num68 < Main.maxTilesX - 1 && num69 > 0 && num69 < Main.maxTilesY - 1 && Main.tile[num68, num69] != null && Main.tile[num68, num69].active()) + { + bool flag7 = false; + if (Main.tile[num68, num69].type == 185 && Main.tile[num68, num69].frameY == 18) + { + if (Main.tile[num68, num69].frameX >= 576 && Main.tile[num68, num69].frameX <= 882) + { + flag7 = true; + } + } + else if (Main.tile[num68, num69].type == 186 && Main.tile[num68, num69].frameX >= 864 && Main.tile[num68, num69].frameX <= 1170) + { + flag7 = true; + } + if (flag7 || Main.tileSpelunker[(int)Main.tile[num68, num69].type] || (Main.tileAlch[(int)Main.tile[num68, num69].type] && Main.tile[num68, num69].type != 82)) + { + int num70 = Dust.NewDust(new Vector2((float)(num68 * 16), (float)(num69 * 16)), 16, 16, 204, 0f, 0f, 150, default(Color), 0.3f); + Main.dust[num70].fadeIn = 0.75f; + Main.dust[num70].velocity *= 0.1f; + Main.dust[num70].noLight = true; + } + } + } + } + } + } + } + } #endregion #region StandingStillEffects @@ -3936,27 +4591,43 @@ namespace CalamityMod { rogueStealth -= rogueStealthMax * 0.006f; if (rogueStealth < 0f) - { rogueStealth = 0f; - } } } - else if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) + else if ((((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1) || (penumbra && (!Main.dayTime || Main.eclipse))) && !player.mount.Active) { if (rogueStealth < rogueStealthMax) { - rogueStealth += rogueStealthMax * 0.006f; //180 ticks, 3 seconds to reach full stealth + rogueStealth += rogueStealthMax * (Main.eclipse ? 0.012f : 0.006f); //180 ticks, 3 seconds to reach full stealth if (rogueStealth > rogueStealthMax) - { rogueStealth = rogueStealthMax; - } } } } else - { rogueStealth = 0f; + + if (trinketOfChi) + { + if (trinketOfChiBuff) + { + AllDamageBoost(0.5f); + if (player.itemAnimation > 0) + chiBuffTimer = 0; + } + if ((double)Math.Abs(player.velocity.X) < 0.1 && (double)Math.Abs(player.velocity.Y) < 0.1 && !player.mount.Active) + { + if (chiBuffTimer < 120) + chiBuffTimer++; + else + player.AddBuff(mod.BuffType("ChiBuff"), 6); + } + else + chiBuffTimer--; } + else + chiBuffTimer = 0; + if (aquaticEmblem) { if ((Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) && player.wet && !player.lavaWet && !player.honeyWet) && @@ -3969,9 +4640,7 @@ namespace CalamityMod { aquaticBoost = 0f; if (Main.netMode == 1) - { NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } } } } @@ -3979,17 +4648,16 @@ namespace CalamityMod { aquaticBoost += 0.0002f; if (aquaticBoost > 1f) - { aquaticBoost = 1f; - } if (player.mount.Active) - { aquaticBoost = 1f; - } } player.statDefense += (int)((1f - aquaticBoost) * 30f); player.moveSpeed -= (1f - aquaticBoost) * 0.1f; } + else + aquaticBoost = 1f; + if (auricBoost) { if (player.itemAnimation > 0) @@ -4005,9 +4673,7 @@ namespace CalamityMod { modStealth = 0f; if (Main.netMode == 1) - { NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } } } } @@ -4016,22 +4682,16 @@ namespace CalamityMod float num27 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); modStealth += num27 * 0.0075f; if (modStealth > 1f) - { modStealth = 1f; - } if (player.mount.Active) - { modStealth = 1f; - } } float damageBoost = (1f - modStealth) * 0.2f; AllDamageBoost(damageBoost); int critBoost = (int)((1f - modStealth) * 10f); AllCritBoost(critBoost); if (modStealthTimer > 0) - { modStealthTimer--; - } } else if (pAmulet) { @@ -4048,9 +4708,7 @@ namespace CalamityMod { modStealth = 0f; if (Main.netMode == 1) - { NetMessage.SendData(84, -1, -1, null, player.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } } } } @@ -4059,26 +4717,18 @@ namespace CalamityMod float num27 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); modStealth += num27 * 0.0075f; if (modStealth > 1f) - { modStealth = 1f; - } if (player.mount.Active) - { modStealth = 1f; - } } - player.meleeDamage += (1f - modStealth) * 0.2f; - player.meleeCrit += (int)((1f - modStealth) * 10f); + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += (1f - modStealth) * 0.2f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += (int)((1f - modStealth) * 10f); player.aggro -= (int)((1f - modStealth) * 750f); if (modStealthTimer > 0) - { modStealthTimer--; - } } else - { modStealth = 1f; - } #endregion #region ElysianAegis @@ -4161,10 +4811,62 @@ namespace CalamityMod #endregion #region OtherBuffs + if (gravityNormalizer) + { + player.buffImmune[BuffID.VortexDebuff] = true; + float x = (float)(Main.maxTilesX / 4200); + x *= x; + float spaceGravityMult = (float)((double)(player.position.Y / 16f - (60f + 10f * x)) / (Main.worldSurface / 6.0)); + if (spaceGravityMult < 1f) + { + player.gravity = Player.defaultGravity; + if (player.wet) + { + if (player.honeyWet) + player.gravity = 0.1f; + else if (player.merman) + player.gravity = 0.3f; + else + player.gravity = 0.2f; + } + } + } + if (astralInjection) + { + if (player.statMana < player.statManaMax2) + { + player.statMana += 3; + } + if (player.statMana > player.statManaMax2) + { + player.statMana = player.statManaMax2; + } + } + if (armorCrumbling) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 5; + player.meleeCrit += 5; + } + if (armorShattering) + { + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.08f; + player.meleeDamage += 0.08f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 8; + player.meleeCrit += 8; + } + if (holyWrath) + { + AllDamageBoost(0.12f); + player.moveSpeed += 0.05f; + } + if (profanedRage) + { + AllCritBoost(12); + player.moveSpeed += 0.05f; + } if (irradiated) { player.statDefense -= 10; - player.endurance -= 0.1f; AllDamageBoost(0.05f); player.minionKB += 0.5f; player.moveSpeed += 0.05f; @@ -4220,16 +4922,16 @@ namespace CalamityMod if (darkSunRing) { player.maxMinions += 2; - AllDamageBoost(0.1f); - player.minionKB += 1f; - player.pickSpeed -= 0.3f; + AllDamageBoost(0.12f); + player.minionKB += 1.2f; + player.pickSpeed -= 0.15f; if (Main.dayTime) { - player.lifeRegen += 2; + player.lifeRegen += 3; } else { - player.statDefense += 20; + player.statDefense += 30; } } if (eGauntlet) @@ -4406,9 +5108,7 @@ namespace CalamityMod { float distance = (Main.npc[m].Center - player.Center).Length(); if (distance < 120f) - { Main.npc[m].AddBuff(mod.BuffType("PearlAura"), 2, false); - } } } } @@ -4425,19 +5125,36 @@ namespace CalamityMod if (harpyRing) { if (player.wingTimeMax > 0) - { player.wingTimeMax = (int)((double)player.wingTimeMax * 1.25); - } player.moveSpeed += 0.2f; } if (blueCandle) { if (player.wingTimeMax > 0) - { player.wingTimeMax = (int)((double)player.wingTimeMax * 1.1); - } player.moveSpeed += 0.15f; } + if (plaguebringerGoliathLore) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.25); + } + if (soaring) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.1); + } + if (draconicSurge) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 1.35); + } + if (bounding) + { + player.jumpSpeedBoost += 0.5f; + Player.jumpHeight += 10; + player.extraFall += 25; + } if (community) { float floatTypeBoost = 0.01f + @@ -4473,18 +5190,45 @@ namespace CalamityMod int hasBuff = player.buffType[l]; bool shouldAffect = CalamityMod.alcoholList.Contains(hasBuff); if (shouldAffect) - { lesserEffect = true; - } } if (player.lifeRegen < 0) - { player.lifeRegen += lesserEffect ? 1 : regenBoost; - } if (player.wingTimeMax > 0) - { player.wingTimeMax = (int)((double)player.wingTimeMax * 1.15); - } + } + if (ravagerLore) + { + if (player.wingTimeMax > 0) + player.wingTimeMax = (int)((double)player.wingTimeMax * 0.5); + AllDamageBoost(0.05f); + } + if (corrEffigy) + { + player.moveSpeed += 0.15f; + AllCritBoost(10); + } + if (crimEffigy) + { + AllDamageBoost(0.15f); + player.statDefense += 10; + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.8); + } + if (badgeOfBraveryRare) + { + player.meleeDamage += 0.2f; + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); + } + if (regenator) + { + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.5); + player.lifeRegenTime += 8; + player.lifeRegen += 16; + } + if (calamitasLore) + { + player.statLifeMax2 = (int)((double)player.statLifeMax2 * 0.75); + player.maxMinions += 2; } if (pinkCandle) { @@ -4502,13 +5246,9 @@ namespace CalamityMod if (rBrain) { if (player.statLife <= (int)((double)player.statLifeMax2 * 0.75)) - { AllDamageBoost(0.1f); - } if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) - { player.moveSpeed -= 0.05f; - } } if (bloodyWormTooth) { @@ -4671,6 +5411,12 @@ namespace CalamityMod AllDamageBoost(0.25f); player.statDefense /= 2; } + if (deepDiver) + { + AllDamageBoost(0.15f); + player.statDefense += (int)((double)player.statDefense * 0.15); + player.moveSpeed += 0.15f; + } if (coreOfTheBloodGod) { player.endurance += 0.05f; @@ -4741,6 +5487,35 @@ namespace CalamityMod player.maxMinions += 2; } } + if (brimstoneElementalLore && player.inferno) + { + int num = mod.BuffType("BrimstoneFlames"); + float num2 = 300f; + bool flag = player.infernoCounter % 30 == 0; + int damage = 50; + if (player.whoAmI == Main.myPlayer) + { + for (int l = 0; l < 200; l++) + { + NPC nPC = Main.npc[l]; + if (nPC.active && !nPC.friendly && nPC.damage > 0 && !nPC.dontTakeDamage && Vector2.Distance(player.Center, nPC.Center) <= num2) + { + if (nPC.FindBuffIndex(num) == -1 && !nPC.buffImmune[num]) + { + nPC.AddBuff(num, 120, false); + } + if (flag) + { + player.ApplyDamageToNPC(nPC, damage, 0f, 0, false); + } + } + } + } + } + if (plaguebringerGoliathLore) + { + player.lifeRegen /= 2; + } #endregion #region LimitsAndOtherShit @@ -4759,11 +5534,23 @@ namespace CalamityMod player.statDefense += (int)((double)damageReductionAboveCap * 100.0); player.endurance = defEndurance + (damageReductionAboveCap * 0.1f); //0.33 + (0.27 * 0.1) = 0.357 } + if (vHex) + { + player.endurance -= 0.3f; + } + if (irradiated) + { + player.endurance -= 0.1f; + } + if (corrEffigy) + { + player.endurance -= 0.2f; + } if (CalamityWorld.revenge) { if (player.statLife < player.statLifeMax2) { - bool noLifeRegenCap = ((player.shinyStone || draedonsHeart || cFreeze || shadeRegen) && + bool noLifeRegenCap = ((player.shinyStone || draedonsHeart || cFreeze || shadeRegen || photosynthesis) && (double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0); if (!noLifeRegenCap) { @@ -4771,7 +5558,7 @@ namespace CalamityMod //350 HP = 1 - 0.875 * 10 = 1.25 = 1 //100 HP = 1 - 0.25 * 10 = 7.5 = 7 //200 HP = 1 - 0.5 * 10 = 5 - int lifeRegenScale = (int)(1f - ((float)player.statLife / (float)player.statLifeMax2)) * 10; //9 to 0 (1% HP to 100%) + int lifeRegenScale = (int)((1f - ((float)player.statLife / (float)player.statLifeMax2)) * 10f); //9 to 0 (1% HP to 100%) if (player.lifeRegen > lifeRegenScale) { double lifeRegenScalar = (double)(1f + ((float)player.statLife / (float)player.statLifeMax2)); //1 to 2 (1% HP to 100%) @@ -4781,6 +5568,19 @@ namespace CalamityMod } } } + if (CalamityWorld.bossRushActive) + { + if (Config.BossRushHealthCurse) + { + if (player.lifeRegen > 0) + player.lifeRegen = 0; + + player.lifeRegenTime = 0; + + if (player.lifeRegenCount > 0) + player.lifeRegenCount = 0; + } + } if (Config.ProficiencyEnabled) { GetStatBonuses(); @@ -4872,7 +5672,15 @@ namespace CalamityMod } if (marked || reaperToothNecklace) { - player.endurance *= 0.5f; + if (player.endurance > 0f) + player.endurance *= 0.5f; + } + if (yharonLore && !CalamityWorld.defiled) + { + if (player.wingTimeMax < 50000) + { + player.wingTimeMax = 50000; + } } #endregion } @@ -4880,90 +5688,62 @@ namespace CalamityMod public override void PostUpdateRunSpeeds() { #region SpeedBoosts - if (hAttack) + float runAccMult = 1f + + ((hAttack && !Main.dayTime) ? 0.05f : 0f) + + ((stressPills || laudanum || draedonsHeart) ? 0.05f : 0f) + + ((abyssalDivingSuit && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.05f : 0f) + + (sirenWaterBuff ? 0.15f : 0f) + + ((frostFlare && player.statLife < (int)((double)player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + + (shadowSpeed ? 0.5f : 0f) + + (auricSet ? 0.1f : 0f) + + (silvaSet ? 0.05f : 0f) + + (cTracers ? 0.1f : 0f) + + (eTracers ? 0.05f : 0f) + + (blueCandle ? 0.05f : 0f) + + ((deepDiver && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.15f : 0f) + + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); + + float runSpeedMult = 1f + + ((hAttack && !Main.dayTime) ? 0.05f : 0f) + + ((stressPills || laudanum || draedonsHeart) ? 0.05f : 0f) + + ((abyssalDivingSuit && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.05f : 0f) + + (sirenWaterBuff ? 0.15f : 0f) + + ((frostFlare && player.statLife < (int)((double)player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + + (shadowSpeed ? 0.5f : 0f) + + (auricSet ? 0.1f : 0f) + + (silvaSet ? 0.05f : 0f) + + (cTracers ? 0.1f : 0f) + + (eTracers ? 0.05f : 0f) + + ((deepDiver && Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) ? 0.15f : 0f) + + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); + + if (abyssalDivingSuit && !Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - if (!Main.dayTime) - { - player.runAcceleration *= 1.05f; - player.maxRunSpeed *= 1.05f; - } - } - if (stressPills || laudanum || draedonsHeart) - { - player.runAcceleration *= 1.05f; - player.maxRunSpeed *= 1.05f; - } - if (abyssalDivingSuit) - { - player.runAcceleration *= Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) ? 1.05f : 0.4f; - player.maxRunSpeed *= Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) ? 1.05f : 0.4f; - } - if (sirenWaterBuff) - { - player.runAcceleration *= 1.15f; - player.maxRunSpeed *= 1.15f; - } - if (frostFlare && player.statLife < (int)((double)player.statLifeMax2 * 0.25)) - { - player.runAcceleration *= 1.15f; - player.maxRunSpeed *= 1.15f; - } - if (shadowSpeed) - { - player.runAcceleration *= 1.5f; - player.maxRunSpeed *= 1.5f; - } - else if (auricSet) - { - player.runAcceleration *= 1.1f; - player.maxRunSpeed *= 1.1f; - } - else if (silvaSet) - { - player.runAcceleration *= 1.05f; - player.maxRunSpeed *= 1.05f; - } - if (cTracers) - { - player.runAcceleration *= 1.1f; - player.maxRunSpeed *= 1.1f; - } - else if (eTracers) - { - player.runAcceleration *= 1.05f; - player.maxRunSpeed *= 1.05f; - } - if (blueCandle) - { - player.runAcceleration *= 1.05f; + runAccMult *= 0.4f; + runSpeedMult *= 0.4f; } if (horror) { - player.runAcceleration *= 0.85f; - player.maxRunSpeed *= 0.85f; + runAccMult *= 0.85f; + runSpeedMult *= 0.85f; + } + if (fabledTortoise) + { + runAccMult *= 0.5f; + runSpeedMult *= 0.5f; } if (elysianGuard) { - player.runAcceleration *= 0.5f; - player.maxRunSpeed *= 0.5f; + runAccMult *= 0.5f; + runSpeedMult *= 0.5f; } - if (player.powerrun && CalamityWorld.revenge) //asphalt + if (player.powerrun && CalamityWorld.revenge) { - player.maxRunSpeed *= 0.6666667f; //base is 3 * 3.5 = 10.5 * 0.6666667 = 7.0 - } - if (rogueStealthMax > 0f) - { - if (rogueStealth >= rogueStealthMax) //full stealth, more speed - { - player.runAcceleration *= 1f + (rogueStealth * 0.05f); - player.maxRunSpeed *= 1f + (rogueStealth * 0.05f); - } - else - { - player.runAcceleration *= 1f + (rogueStealth * 0.025f); - player.maxRunSpeed *= 1f + (rogueStealth * 0.025f); - } + runSpeedMult *= 0.6666667f; } + + player.runAcceleration *= runAccMult; + player.maxRunSpeed *= runSpeedMult; #endregion #region DashEffects @@ -4973,9 +5753,9 @@ namespace CalamityMod } else if (player.grappling[0] == -1 && !player.tongued) { + ModHorizontalMovement(); if (dashMod > 0) { - ModHorizontalMovement(); ModDashMovement(); } if (pAmulet && modStealth < 1f) @@ -5030,6 +5810,10 @@ namespace CalamityMod } player.statLife += 100; player.HealEffect(100); + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } return false; } if (godSlayer && !godSlayerCooldown) @@ -5050,8 +5834,18 @@ namespace CalamityMod Main.dust[num].scale *= 1f + (float)Main.rand.Next(40) * 0.01f; } } - player.statLife += 150; - player.HealEffect(150); + int heal = draconicSurge ? player.statLifeMax2 : 150; + player.statLife += heal; + player.HealEffect(heal); + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + if (player.FindBuffIndex(mod.BuffType("DraconicSurgeBuff")) > -1) + { + player.ClearBuff(mod.BuffType("DraconicSurgeBuff")); + draconicSurgeCooldown = 1800; + } player.AddBuff(mod.BuffType("GodSlayerCooldown"), 2700); return false; } @@ -5065,6 +5859,20 @@ namespace CalamityMod { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaActivation"), (int)player.position.X, (int)player.position.Y); player.AddBuff(mod.BuffType("SilvaRevival"), 600); + if (draconicSurge) + { + player.statLife += player.statLifeMax2; + player.HealEffect(player.statLifeMax2); + if (player.statLife > player.statLifeMax2) + { + player.statLife = player.statLifeMax2; + } + if (player.FindBuffIndex(mod.BuffType("DraconicSurgeBuff")) > -1) + { + player.ClearBuff(mod.BuffType("DraconicSurgeBuff")); + draconicSurgeCooldown = 1800; + } + } } hasSilvaEffect = true; if (player.statLife < 1) @@ -5110,6 +5918,11 @@ namespace CalamityMod sCalDeathCount++; } } + deathCount++; + if (player.whoAmI == Main.myPlayer && Main.netMode == 1) + { + DeathPacket(false); + } if (CalamityWorld.ironHeart && areThereAnyDamnBosses) { KillPlayer(); @@ -5140,14 +5953,21 @@ namespace CalamityMod #region GetWeaponDamageAndKB public override void GetWeaponDamage(Item item, ref int damage) { + bool isTrueMelee = item.melee && (item.shoot == 0 || (item.noMelee && item.noUseGraphic && item.useStyle == 5 && !CalamityMod.trueMeleeBoostExceptionList.Contains(item.type))); + if (isTrueMelee) + { + double damageMult = 1.0 + + (dodgeScarf ? 0.2 : 0.0) + + ((aBulwarkRare && aBulwarkRareMeleeBoostTimer > 0) ? 2.0 : 0.0) + + (DoGLore ? 0.5 : 0.0) + + (fungalSymbiote ? 0.25 : 0.0); + + damage = (int)((double)damage * damageMult); + } if (flamethrowerBoost && item.ranged && item.useAmmo == 23) { damage = (int)((double)damage * 1.25); } - if (dodgeScarf && item.melee && item.shoot == 0) - { - damage = (int)((double)damage * 1.2); - } if ((cinnamonRoll && CalamityMod.fireWeaponList.Contains(item.type)) || (evergreenGin && CalamityMod.natureWeaponList.Contains(item.type))) { damage = (int)((double)damage * 1.15); @@ -5156,14 +5976,24 @@ namespace CalamityMod { damage = (int)((double)damage * 1.1); } + if (theBee && player.statLife >= player.statLifeMax2) + { + if (item.melee || item.ranged || item.magic || item.GetGlobalItem(mod).rogue) + { + double useTimeBeeMultiplier = (double)(item.useTime * item.useAnimation) / 3600.0; //28 * 28 = 784 is average so that equals 784 / 3600 = 0.217777 = 21.7% boost + if (useTimeBeeMultiplier > 1.5) + useTimeBeeMultiplier = 1.5; + theBeeDamage = (int)((double)item.damage * useTimeBeeMultiplier); + } + } + if (!theBee) + { + theBeeDamage = 0; + } } public override void GetWeaponKnockback(Item item, ref float knockback) { - if (pAmulet && item.melee) - { - knockback *= 1f + (1f - modStealth) * 0.5f; - } if (auricBoost) { knockback *= 1f + (1f - modStealth) * 0.5f; @@ -5190,54 +6020,124 @@ namespace CalamityMod #region MeleeEffects public override void MeleeEffects(Item item, Rectangle hitbox) { - if (aWeapon && item.melee && !item.noMelee && !item.noUseGraphic) + bool isTrueMelee = item.melee && (item.shoot == 0 || (item.noMelee && item.noUseGraphic && item.useStyle == 5 && !CalamityMod.trueMeleeBoostExceptionList.Contains(item.type))); + if (isTrueMelee) { - if (Main.rand.Next(3) == 0) + if (fungalSymbiote && player.whoAmI == Main.myPlayer) { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("BrimstoneFlame"), player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 0.75f); + if ((player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9))) + { + float num339 = 0f; + float num340 = 0f; + float num341 = 0f; + float num342 = 0f; + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) + { + num339 = -7f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num339 = -6f; + num340 = 2f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5)) + { + num339 = -4f; + num340 = 4f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) + { + num339 = -2f; + num340 = 6f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) + { + num340 = 7f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num342 = 26f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) + { + num342 -= 4f; + num341 -= 20f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) + { + num341 += 6f; + } + if (player.direction == -1) + { + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) + { + num342 -= 8f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num342 -= 6f; + } + } + num339 *= 1.5f; + num340 *= 1.5f; + num342 *= (float)player.direction; + num341 *= player.gravDir; + Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, (float)player.direction * num340, num339 * player.gravDir, ProjectileID.Mushroom, (int)((float)item.damage * 0.25f * player.meleeDamage), 0f, player.whoAmI, 0f, 0f); + } } - } - if (aChicken && item.melee && !item.noMelee && !item.noUseGraphic) - { - if (Main.rand.Next(3) == 0) + if (aWeapon) { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 244, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 0.75f); + if (Main.rand.Next(3) == 0) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("BrimstoneFlame"), player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 0.75f); + } } - } - if (eGauntlet && item.melee && !item.noMelee && !item.noUseGraphic) - { - if (Main.rand.Next(3) == 0) + if (aChicken) { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); - Main.dust[num280].noGravity = true; + if (Main.rand.Next(3) == 0) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 244, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 0.75f); + } } - } - if (cryogenSoul && item.melee && !item.noMelee && !item.noUseGraphic) - { - if (Main.rand.Next(3) == 0) + if (eGauntlet) { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 67, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 0.75f); + if (Main.rand.Next(3) == 0) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.25f); + Main.dust[num280].noGravity = true; + } } - } - if (xerocSet && item.melee && !item.noMelee && !item.noUseGraphic) - { - if (Main.rand.Next(3) == 0) + if (cryogenSoul) { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 58, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 1.25f); + if (Main.rand.Next(3) == 0) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 67, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 0.75f); + } } - } - if (reaverBlast && item.melee && !item.noMelee && !item.noUseGraphic) - { - if (Main.rand.Next(3) == 0) + if (xerocSet) { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 74, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 0.75f); + if (Main.rand.Next(3) == 0) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 58, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 1.25f); + } } - } - if (dsSetBonus && item.melee && !item.noMelee && !item.noUseGraphic) - { - if (Main.rand.Next(3) == 0) + if (reaverBlast) { - int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 27, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 2.5f); + if (Main.rand.Next(3) == 0) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 74, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 0.75f); + } + } + if (dsSetBonus) + { + if (Main.rand.Next(3) == 0) + { + int num280 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 27, player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f, 100, default(Color), 2.5f); + } } } } @@ -5372,6 +6272,28 @@ namespace CalamityMod target.AddBuff(mod.BuffType("Plague"), 120, false); } } + if (armorCrumbling || armorShattering) + { + if (item.melee || item.GetGlobalItem(mod).rogue) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 120, false); + } + } + } + if (holyWrath) + { + target.AddBuff(mod.BuffType("HolyLight"), 600, false); + } } #endregion @@ -5414,7 +6336,11 @@ namespace CalamityMod target.AddBuff(mod.BuffType("DemonFlames"), 120, false); } } - if (alchFlask) + if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189)) + { + target.AddBuff(mod.BuffType("Plague"), 360); + } + else if (alchFlask) { if (Main.rand.Next(4) == 0) { @@ -5510,6 +6436,40 @@ namespace CalamityMod } } } + if (armorCrumbling || armorShattering) + { + if (proj.melee || proj.GetGlobalProjectile(mod).rogue) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 120, false); + } + } + } + if (perforatorLore) + { + target.AddBuff(BuffID.Ichor, 450); + } + if (hiveMindLore) + { + target.AddBuff(BuffID.CursedInferno, 450); + } + if (holyWrath) + { + target.AddBuff(mod.BuffType("HolyLight"), 600, false); + } + else if (providenceLore) + { + target.AddBuff(mod.BuffType("HolyLight"), 450, false); + } } #endregion @@ -5627,6 +6587,10 @@ namespace CalamityMod target.AddBuff(mod.BuffType("Plague"), 120, false); } } + if (holyWrath) + { + target.AddBuff(mod.BuffType("HolyLight"), 600, false); + } } public override void OnHitPvpWithProj(Projectile proj, Player target, int damage, bool crit) @@ -5652,7 +6616,11 @@ namespace CalamityMod target.AddBuff(mod.BuffType("CrushDepth"), 120, false); } } - if (alchFlask) + if (uberBees && (proj.type == 566 || proj.type == 181 || proj.type == 189)) + { + target.AddBuff(mod.BuffType("Plague"), 360); + } + else if (alchFlask) { if (Main.rand.Next(4) == 0) { @@ -5748,22 +6716,55 @@ namespace CalamityMod } } } + if (armorCrumbling || armorShattering) + { + if (proj.melee || proj.GetGlobalProjectile(mod).rogue) + { + if (Main.rand.Next(4) == 0) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 360, false); + } + else if (Main.rand.Next(2) == 0) + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 240, false); + } + else + { + target.AddBuff(mod.BuffType("ArmorCrunch"), 120, false); + } + } + } + if (perforatorLore) + { + target.AddBuff(BuffID.Ichor, 450); + } + if (hiveMindLore) + { + target.AddBuff(BuffID.CursedInferno, 450); + } + if (holyWrath) + { + target.AddBuff(mod.BuffType("HolyLight"), 600, false); + } + else if (providenceLore) + { + target.AddBuff(mod.BuffType("HolyLight"), 450, false); + } } #endregion #region ModifyHitNPC public override void ModifyHitNPC(Item item, NPC target, ref int damage, ref float knockback, ref bool crit) { - if (silvaMelee && Main.rand.Next(4) == 0) + #region MultiplierBoosts + double damageMult = 1.0; + if (silvaMelee && Main.rand.Next(4) == 0 && item.melee) { - damage *= 5; + damageMult += 4.0; } - if (ataxiaGeyser && item.melee && !item.noMelee && !item.noUseGraphic) + if (enraged && !Config.BossRushXerocCurse) { - if (player.whoAmI == Main.myPlayer && player.ownedProjectileCounts[mod.ProjectileType("ChaosGeyser")] < 3) - { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("ChaosGeyser"), (int)((double)item.damage * 0.15), 2f, player.whoAmI, 0f, 0f); - } + damageMult += 1.25; } if (CalamityWorld.revenge && Config.AdrenalineAndRage) { @@ -5772,7 +6773,7 @@ namespace CalamityMod { if (item.melee) { - damage = (int)((double)damage * (CalamityWorld.death ? (DHorHoD ? 9.9 : 9.0) : (DHorHoD ? 3.3 : 3.0))); + damageMult += (CalamityWorld.death ? (DHorHoD ? 8.9 : 8.0) : (DHorHoD ? 2.3 : 2.0)); } } else if (rageMode) @@ -5783,18 +6784,25 @@ namespace CalamityMod (rageBoostOne ? (CalamityWorld.death ? 0.6 : 0.15) : 0.0) + //3.6 or 1.65 (rageBoostTwo ? (CalamityWorld.death ? 0.6 : 0.15) : 0.0) + //4.2 or 1.8 (rageBoostThree ? (CalamityWorld.death ? 0.6 : 0.15) : 0.0); //4.8 or 1.95 - double rageDamage = (CalamityWorld.death ? (DHorHoD ? 3.3 : 3.0) : (DHorHoD ? 1.65 : 1.5)) + rageDamageBoost; - damage = (int)((double)damage * rageDamage); + double rageDamage = (CalamityWorld.death ? (DHorHoD ? 2.3 : 2.0) : (DHorHoD ? 0.65 : 0.5)) + rageDamageBoost; + damageMult += rageDamage; } } else if (adrenalineMode) { if (item.melee) { - damage = (int)((double)damage * ((CalamityWorld.death ? 7.0 : 2.5) * adrenalineDmgMult)); + double damageMultAdr = (CalamityWorld.death ? 6.0 : 1.5) * (double)adrenalineDmgMult; + damageMult += damageMultAdr; } } } + damage = (int)((double)damage * damageMult); + #endregion + + if (yharonLore) + damage = (int)((double)damage * 0.75); + if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) { if (item.type == mod.ItemType("Ataraxia")) @@ -5807,7 +6815,64 @@ namespace CalamityMod ataraxiaDamageBoost += 0.01f; } } - if (bloodflareMelee) + if (item.melee && !item.noMelee && !item.noUseGraphic) + { + if (ataxiaGeyser) + { + if (player.ownedProjectileCounts[mod.ProjectileType("ChaosGeyser")] < 3) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("ChaosGeyser"), (int)((double)damage * 0.15), 2f, player.whoAmI, 0f, 0f); + } + } + if (unstablePrism && crit) + { + for (int num252 = 0; num252 < 3; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(30, 61) * 0.1f; + Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, mod.ProjectileType("UnstableSpark"), (int)((double)damage * 0.15), 0f, player.whoAmI, 0f, 0f); + } + } + } + if (astralStarRain && crit && astralStarRainCooldown <= 0) + { + astralStarRainCooldown = 60; + for (int n = 0; n < 3; n++) + { + float x = target.position.X + (float)Main.rand.Next(-400, 400); + float y = target.position.Y - (float)Main.rand.Next(500, 800); + Vector2 vector = new Vector2(x, y); + float num13 = target.position.X + (float)(target.width / 2) - vector.X; + float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + float num15 = 25f; + int projectileType = Main.rand.Next(3); + if (projectileType == 0) + { + projectileType = mod.ProjectileType("AstralStar"); + } + else if (projectileType == 1) + { + projectileType = 92; + } + else + { + projectileType = 12; + } + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = num15 / num16; + num13 *= num16; + num14 *= num16; + int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 75, 5f, player.whoAmI, 0f, 0f); + Main.projectile[num17].ranged = false; + } + } + if (bloodflareMelee && item.melee) { if (bloodflareMeleeHits < 15 && bloodflareFrenzyTimer <= 0 && bloodflareFrenzyCooldown <= 0) { @@ -5848,7 +6913,7 @@ namespace CalamityMod } if (CalamityWorld.revenge && Config.AdrenalineAndRage) { - if (item.shoot == 0 || item.shoot == mod.ProjectileType("NobodyKnows")) + if (item.melee) { int stressGain = (int)((double)damage * 0.1); int stressMaxGain = 10; @@ -5868,9 +6933,226 @@ namespace CalamityMod } } } - if (astralStarRain && crit && astralStarRainCooldown <= 0) + } + + public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + bool isTrueMelee = proj.GetGlobalProjectile(mod).trueMelee; + bool isSummon = proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type); + bool hasClassType = proj.melee || proj.ranged || proj.magic || isSummon || proj.GetGlobalProjectile(mod).rogue; + + if (proj.GetGlobalProjectile(mod).rogue) { - if (player.whoAmI == Main.myPlayer) + crit = (Main.rand.Next(1, 101) < CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit); + } + + #region MultiplierBoosts + double damageMult = 1.0; + if (isSummon) + { + if ((player.inventory[player.selectedItem].summon && + !player.inventory[player.selectedItem].melee && + !player.inventory[player.selectedItem].ranged && + !player.inventory[player.selectedItem].magic && + !player.inventory[player.selectedItem].thrown) || + player.inventory[player.selectedItem].hammer > 0 || + player.inventory[player.selectedItem].pick > 0 || + player.inventory[player.selectedItem].axe > 0) + { + damageMult += 0.1; + } + } + if (screwdriver) + { + if (proj.penetrate > 1 || proj.penetrate == -1) + damageMult += 0.1; + } + if (sPower) + { + if (isSummon) + damageMult += 0.1; + } + if (providenceLore && hasClassType) + { + damageMult += 0.05; + } + if (silvaMelee && Main.rand.Next(4) == 0 && isTrueMelee) + { + damageMult += 4.0; + } + if (enraged && !Config.BossRushXerocCurse) + { + damageMult += 1.25; + } + if (auricSet) + { + if (silvaThrowing && proj.GetGlobalProjectile(mod).rogue && + crit && player.statLife > (int)((double)player.statLifeMax2 * 0.5)) + { + damageMult += 0.25; + } + if (silvaMelee && proj.melee) + { + double multiplier = (double)player.statLife / (double)player.statLifeMax2; + damageMult += multiplier * 0.2; + } + } + if (godSlayerRanged && crit && proj.ranged) + { + int randomChance = 100 - player.rangedCrit; //100 min to 15 max with cap + + if (randomChance < 15) + randomChance = 15; + if (Main.rand.Next(randomChance) == 0) + damageMult += 1.0; + } + if (silvaCountdown > 0 && hasSilvaEffect && silvaRanged && proj.ranged) + { + damageMult += 0.4; + } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaThrowing && proj.GetGlobalProjectile(mod).rogue) + { + damageMult += 0.1; + } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaMage && proj.magic) + { + damageMult += 0.1; + } + if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon && isSummon) + { + damageMult += 0.1; + } + if (proj.type == mod.ProjectileType("FrostsparkBullet")) + { + if (target.buffImmune[mod.BuffType("GlacialState")]) + damageMult += 0.2; + } + if (CalamityWorld.revenge) + { + bool DHorHoD = (draedonsHeart || heartOfDarkness); + if (rageMode && adrenalineMode) + { + if (hasClassType) + { + damageMult += (CalamityWorld.death ? (DHorHoD ? 8.9 : 8.0) : (DHorHoD ? 2.3 : 2.0)); + } + } + else if (rageMode) + { + if (hasClassType) + { + double rageDamageBoost = 0.0 + + (rageBoostOne ? (CalamityWorld.death ? 0.6 : 0.15) : 0.0) + //3.6 or 1.65 + (rageBoostTwo ? (CalamityWorld.death ? 0.6 : 0.15) : 0.0) + //4.2 or 1.8 + (rageBoostThree ? (CalamityWorld.death ? 0.6 : 0.15) : 0.0); //4.8 or 1.95 + double rageDamage = (CalamityWorld.death ? (DHorHoD ? 2.3 : 2.0) : (DHorHoD ? 0.65 : 0.5)) + rageDamageBoost; + damageMult += rageDamage; + } + } + else if (adrenalineMode) + { + if (hasClassType) + { + double damageMultAdr = (CalamityWorld.death ? 6.0 : 1.5) * (double)adrenalineDmgMult; + damageMult += damageMultAdr; + } + } + } + damage = (int)((double)damage * damageMult); + #endregion + + #region AdditiveBoosts + if (theBee && !isSummon) + { + damage += theBeeDamage; + } + if (proj.type == mod.ProjectileType("AcidBullet")) + { + int defenseAdd = (int)((double)target.defense * 0.1); //100 defense * 0.1 = 10 + damage += defenseAdd; + } + if (uberBees && (proj.type == ProjectileID.GiantBee || proj.type == ProjectileID.Bee || proj.type == ProjectileID.Wasp || proj.type == mod.ProjectileType("PlagueBee"))) + { + if (player.inventory[player.selectedItem].type == mod.ItemType("TheSwarmer") || player.inventory[player.selectedItem].type == mod.ItemType("PlagueKeeper") || + player.inventory[player.selectedItem].type == mod.ItemType("Plaguenade")) + { + damage += Main.rand.Next(10, 21); + } + else + { + damage += Main.rand.Next(70, 101); + proj.penetrate = 1; + } + } + #endregion + + #region MultiplicativeReductions + if (isSummon) + { + if (!player.inventory[player.selectedItem].summon && + (player.inventory[player.selectedItem].melee || + player.inventory[player.selectedItem].ranged || + player.inventory[player.selectedItem].magic || + player.inventory[player.selectedItem].thrown) && + player.inventory[player.selectedItem].hammer == 0 && + player.inventory[player.selectedItem].pick == 0 && + player.inventory[player.selectedItem].axe == 0) + { + damage = (int)((double)damage * 0.6); + } + } + if (proj.ranged) + { + switch (proj.type) + { + case ProjectileID.CrystalShard: + damage = (int)((double)damage * 0.6); + break; + case ProjectileID.ChlorophyteBullet: + damage = (int)((double)damage * 0.8); + break; + case ProjectileID.HallowStar: + damage = (int)((double)damage * 0.7); + break; + } + if (proj.type == mod.ProjectileType("VeriumBullet")) + damage = (int)((double)damage * 0.8); + } + if (yharonLore) + damage = (int)((double)damage * 0.75); + #endregion + + if (tarraMage && crit && proj.magic) + { + tarraCrits++; + } + if (tarraThrowing && tarraThrowingCritTimer <= 0 && tarraThrowingCrits < 25 && crit && + proj.GetGlobalProjectile(mod).rogue) + { + tarraThrowingCrits++; + } + + if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) + { + if (theBeeDamage > 0 && (proj.melee || proj.ranged || proj.magic || proj.GetGlobalProjectile(mod).rogue)) + { + Main.PlaySound(2, (int)proj.position.X, (int)proj.position.Y, 110); + } + if (unstablePrism && crit) + { + for (int num252 = 0; num252 < 3; num252++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + while (value15.X == 0f && value15.Y == 0f) + { + value15 = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + } + value15.Normalize(); + value15 *= (float)Main.rand.Next(30, 61) * 0.1f; + Projectile.NewProjectile(proj.oldPosition.X + (float)(proj.width / 2), proj.oldPosition.Y + (float)(proj.height / 2), value15.X, value15.Y, mod.ProjectileType("UnstableSpark"), (int)((double)damage * 0.15), 0f, player.whoAmI, 0f, 0f); + } + } + if (astralStarRain && crit && astralStarRainCooldown <= 0) { astralStarRainCooldown = 60; for (int n = 0; n < 3; n++) @@ -5881,7 +7163,7 @@ namespace CalamityMod float num13 = target.position.X + (float)(target.width / 2) - vector.X; float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; num13 += (float)Main.rand.Next(-100, 101); - int num15 = 25; + float num15 = 25f; int projectileType = Main.rand.Next(3); if (projectileType == 0) { @@ -5896,130 +7178,85 @@ namespace CalamityMod projectileType = 12; } float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; + num16 = num15 / num16; num13 *= num16; num14 *= num16; int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 75, 5f, player.whoAmI, 0f, 0f); Main.projectile[num17].ranged = false; } } - } - } - - public override void ModifyHitNPCWithProj(Projectile proj, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (auricSet && silvaThrowing && proj.GetGlobalProjectile(mod).rogue && - crit && player.statLife > (int)((double)player.statLifeMax2 * 0.5)) - { - damage = (int)((double)damage * 1.25); - } - if (auricSet && silvaMelee && proj.melee) - { - double multiplier = (double)player.statLife / (double)player.statLifeMax2; - if (multiplier < 0.84) + if (tarraRanged && crit && proj.ranged) { - multiplier = 0.84; - } - damage = (int)(((double)damage * multiplier) * 1.2); //ranges from 1.2 times to 1 times - } - if (godSlayerRanged && crit && proj.ranged) - { - int randomChance = 100 - player.rangedCrit; //100 min to 15 max with cap - if (randomChance < 15) - { - randomChance = 15; - } - if (Main.rand.Next(randomChance) == 0) - { - damage *= 2; - } - } - if (tarraMage && crit && proj.magic) - { - tarraCrits++; - } - if (tarraRanged && crit && proj.ranged && player.whoAmI == Main.myPlayer) - { - int num251 = Main.rand.Next(2, 4); - for (int num252 = 0; num252 < num251; num252++) - { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) + int num251 = Main.rand.Next(2, 4); + for (int num252 = 0; num252 < num251; num252++) { - 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 FUCKYOU = Projectile.NewProjectile(target.position.X + (float)(target.width / 2), target.position.Y + (float)(target.height / 2), - value15.X, value15.Y, 206, (int)((double)damage * (auricSet ? 0.4 : 0.25)), 0f, player.whoAmI, 0f, 0f); - Main.projectile[FUCKYOU].magic = false; - Main.projectile[FUCKYOU].netUpdate = true; - } - } - if (tarraThrowing && tarraThrowingCritTimer <= 0 && tarraThrowingCrits < 25 && crit && - proj.GetGlobalProjectile(mod).rogue) - { - tarraThrowingCrits++; - } - if (bloodflareThrowing && proj.GetGlobalProjectile(mod).rogue && crit && Main.rand.Next(2) == 0) - { - if (player.whoAmI == Main.myPlayer && target.canGhostHeal) - { - float num11 = 0.03f; - num11 -= (float)proj.numHits * 0.015f; - if (num11 < 0f) - { - num11 = 0f; - } - float num12 = (float)proj.damage * num11; - if (num12 < 0f) - { - num12 = 0f; - } - if (player.lifeSteal > 0f) - { - player.statLife += 1; - player.HealEffect(1); - player.lifeSteal -= num12 * 2f; + 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 FUCKYOU = Projectile.NewProjectile(target.position.X + (float)(target.width / 2), target.position.Y + (float)(target.height / 2), + value15.X, value15.Y, 206, (int)((double)damage * 0.25), 0f, player.whoAmI, 0f, 0f); + Main.projectile[FUCKYOU].magic = false; + Main.projectile[FUCKYOU].netUpdate = true; } } - } - if (bloodflareMage && bloodflareMageCooldown <= 0 && crit && proj.magic && player.whoAmI == Main.myPlayer) - { - bloodflareMageCooldown = 120; - for (int i = 0; i < 3; i++) + if (bloodflareThrowing && proj.GetGlobalProjectile(mod).rogue && crit && Main.rand.Next(2) == 0) { - Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); - while (value15.X == 0f && value15.Y == 0f) + if (target.canGhostHeal) { - value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + float num11 = 0.03f; + num11 -= (float)proj.numHits * 0.015f; + if (num11 < 0f) + { + num11 = 0f; + } + float num12 = (float)proj.damage * num11; + if (num12 < 0f) + { + num12 = 0f; + } + if (player.lifeSteal > 0f) + { + player.statLife += 1; + player.HealEffect(1); + player.lifeSteal -= num12 * 2f; + } + } + } + if (bloodflareMage && bloodflareMageCooldown <= 0 && crit && proj.magic) + { + bloodflareMageCooldown = 120; + for (int i = 0; i < 3; i++) + { + Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); + while (value15.X == 0f && value15.Y == 0f) + { + 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 fire = Projectile.NewProjectile(target.position.X + (float)(target.width / 2), target.position.Y + (float)(target.height / 2), + value15.X, value15.Y, 15, (int)((double)damage * 0.5), 0f, player.whoAmI, 0f, 0f); + Main.projectile[fire].magic = false; + Main.projectile[fire].netUpdate = true; + } + } + if (bloodflareMelee && isTrueMelee) + { + if (bloodflareMeleeHits < 15 && bloodflareFrenzyTimer <= 0 && bloodflareFrenzyCooldown <= 0) + { + bloodflareMeleeHits++; + } + if (player.whoAmI == Main.myPlayer) + { + int healAmount = (Main.rand.Next(3) + 1); + player.statLife += healAmount; + player.HealEffect(healAmount); } - value15.Normalize(); - value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int fire = Projectile.NewProjectile(target.position.X + (float)(target.width / 2), target.position.Y + (float)(target.height / 2), - value15.X, value15.Y, 15, (int)((double)damage * (auricSet ? 11.0 : 6.0)), 0f, player.whoAmI, 0f, 0f); - Main.projectile[fire].magic = false; - Main.projectile[fire].netUpdate = true; } - } - if (silvaCountdown > 0 && hasSilvaEffect && silvaRanged && proj.ranged) - { - damage = (int)((double)damage * 1.4); - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaThrowing && proj.GetGlobalProjectile(mod).rogue) - { - damage = (int)((double)damage * 1.1); - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaMage && proj.magic) - { - damage = (int)((double)damage * 1.1); - } - if (silvaCountdown <= 0 && hasSilvaEffect && silvaSummon && proj.minion) - { - damage = (int)((double)damage * 1.1); - } - if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) - { if (proj.type == mod.ProjectileType("AtaraxiaMain") || proj.type == mod.ProjectileType("AtaraxiaHoming") || proj.type == mod.ProjectileType("AtaraxiaSplit") || proj.type == mod.ProjectileType("AtaraxiaSide")) { @@ -6092,7 +7329,7 @@ namespace CalamityMod LevelPacket(false, 2); } } - else if ((proj.minion || proj.sentry || CalamityMod.projectileMinionList.Contains(proj.type)) && summonLevel <= 12500) + else if (isSummon && summonLevel <= 12500) { if (!Main.hardMode && summonLevel >= 1500) { @@ -6138,9 +7375,7 @@ namespace CalamityMod } if (CalamityWorld.revenge && Config.AdrenalineAndRage) { - if ((proj.melee && proj.ownerHitCheck) || proj.aiStyle == 15 || (proj.aiStyle == 75 && proj.melee) || - proj.type == mod.ProjectileType("Nebulash") || proj.type == mod.ProjectileType("CosmicDischarge") || - proj.type == mod.ProjectileType("MourningStar")) + if (isTrueMelee) { int stressGain = (int)((double)damage * 0.1); int stressMaxGain = 10; @@ -6166,6 +7401,19 @@ namespace CalamityMod #region ModifyHitByNPC public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) { + if (triumph) + { + double HPMultiplier = 0.25 * (1.0 - ((double)npc.life / (double)npc.lifeMax)); + int damageReduction = (int)((double)damage * HPMultiplier); + damage -= damageReduction; + } + if (aSparkRare) + { + if (npc.type == NPCID.BlueJellyfish || npc.type == NPCID.PinkJellyfish || npc.type == NPCID.GreenJellyfish || + npc.type == NPCID.FungoFish || npc.type == NPCID.BloodJelly || npc.type == NPCID.AngryNimbus || npc.type == NPCID.GigaZapper || + npc.type == NPCID.MartianTurret || npc.type == mod.NPCType("StormlionCharger")) + damage /= 2; + } if (fleshTotem && fleshTotemCooldown <= 0) { fleshTotemCooldown = 1200; //20 seconds @@ -6183,16 +7431,18 @@ namespace CalamityMod { damage = (int)((double)damage * 0.8); } - if (CalamityWorld.revenge) + if (aBulwarkRare) { - if (CalamityMod.revengeanceEnemyBuffList.Contains(npc.type)) - damage = (int)((double)damage * 1.25); + aBulwarkRareMeleeBoostTimer += 3 * damage; + if (aBulwarkRareMeleeBoostTimer > 900) + aBulwarkRareMeleeBoostTimer = 900; } - if (player.whoAmI == Main.myPlayer && !player.immune && !lol && !invincible && !hasSilvaEffect) + if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) { if (CalamityWorld.revenge && Config.AdrenalineAndRage && !npc.SpawnedFromStatue) { - int stressGain = (int)((double)damage * 2.0); + gainRageCooldown = 60; + int stressGain = damage * (profanedRage ? 3 : 2); int stressMaxGain = 2500; if (stressGain < 1) { @@ -6215,6 +7465,17 @@ namespace CalamityMod #region ModifyHitByProj public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit) { + if (projRefRare) + { + if (proj.type == projTypeJustHitBy) + damage = (int)((double)damage * 0.85); + } + if (aSparkRare) + { + if (proj.type == ProjectileID.MartianTurretBolt || proj.type == ProjectileID.GigaZapperSpear || proj.type == ProjectileID.CultistBossLightningOrbArc || + proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet) + damage /= 2; + } if (proj.type == ProjectileID.Nail) { damage = (int)((double)damage * 0.75); @@ -6229,21 +7490,17 @@ namespace CalamityMod if (CalamityMod.hardModeNerfList.Contains(proj.type)) damage = (int)((double)damage * 0.75); } - if (CalamityWorld.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)) - { - if (CalamityMod.eventProjectileBuffList.Contains(proj.type)) - damage = (int)((double)damage * 1.5); - } if (CalamityWorld.revenge) { if (CalamityMod.revengeanceProjectileBuffList.Contains(proj.type)) damage = (int)((double)damage * 1.25); } - if (player.whoAmI == Main.myPlayer && !player.immune && !lol && !invincible && !hasSilvaEffect) + if (player.whoAmI == Main.myPlayer && gainRageCooldown <= 0) { if (CalamityWorld.revenge && Config.AdrenalineAndRage && !CalamityMod.trapProjectileList.Contains(proj.type)) { - int stressGain = (int)((double)damage * 2.0); + gainRageCooldown = 60; + int stressGain = damage * (profanedRage ? 3 : 2); int stressMaxGain = 2500; if (stressGain < 1) { @@ -6334,6 +7591,27 @@ namespace CalamityMod proj.velocity.X = -proj.velocity.X; proj.velocity.Y = -proj.velocity.Y; } + if (projRefRare && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.Next(2) == 0) + { + proj.hostile = false; + proj.friendly = true; + proj.velocity.X = -proj.velocity.X * 2f; + proj.velocity.Y = -proj.velocity.Y * 2f; + proj.damage *= 10; + projRefRareLifeRegenCounter = 120; + projTypeJustHitBy = proj.type; + } + if (aSparkRare && proj.active && !proj.friendly && proj.hostile && damage > 0) + { + if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet) + { + proj.hostile = false; + proj.friendly = true; + proj.velocity.X = -proj.velocity.X; + proj.velocity.Y = -proj.velocity.Y; + proj.damage *= 8; + } + } if (daedalusReflect && proj.active && !proj.friendly && proj.hostile && damage > 0 && Main.rand.Next(3) == 0) { int healAmt = damage / 5; @@ -6464,12 +7742,18 @@ namespace CalamityMod player.body = mod.GetEquipSlot("SirenBodyAlt", EquipType.Body); player.head = mod.GetEquipSlot("SirenHeadAlt", EquipType.Head); } + if (NOU) NOULOL(); + if (CalamityWorld.defiled) Defiled(); + if (weakPetrification) WeakPetrification(); + + if (CalamityWorld.bossRushActive) + BossRushMovementChanges(); } #endregion @@ -6513,18 +7797,53 @@ namespace CalamityMod { player.wingTimeMax = 0; } + + private void BossRushMovementChanges() + { + switch (CalamityWorld.bossRushStage) + { + case 0: + case 1: + case 2: + case 3: + case 7: + case 13: + case 14: + case 17: + case 19: + case 22: + player.wingTimeMax = 0; + break; + default: + break; + } + } #endregion #region HurtMethods public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) { - if (CalamityWorld.armageddon) + if (CalamityWorld.armageddon || SCalLore || (CalamityWorld.bossRushActive && bossRushImmunityFrameCurseTimer > 0)) { - if (areThereAnyDamnBosses) + if (areThereAnyDamnBosses || SCalLore || (CalamityWorld.bossRushActive && bossRushImmunityFrameCurseTimer > 0)) { + if (SCalLore) + { + string key = "Mods.CalamityMod.SupremeBossText2"; + Color messageColor = Color.Orange; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } KillPlayer(); } } + if (lol || (invincible && player.inventory[player.selectedItem].type != mod.ItemType("ColdheartIcicle"))) { return false; @@ -6533,193 +7852,7 @@ namespace CalamityMod { return false; } - if (player.beetleDefense && player.beetleOrbs > 0) - { - float newMult = 0.05f * (float)player.beetleOrbs; //.05 .1 .15 - damage = (int)((double)(1f + newMult) * (double)damage); //damage added for one orb : 100 damage = 1.05 * 100 = 105 - } - if (CalamityGlobalNPC.DraedonMayhem) - { - damage = (int)((double)damage * 1.2); - } - if (dArtifact) - { - damage = (int)((double)damage * 1.25); - } - if (CalamityWorld.bossRushActive) - { - switch (CalamityWorld.bossRushStage) - { - case 0: - damage = (int)((double)damage * 5.0); //Tier 1 Queen Bee values adjusted for a median of 250 damage - break; - case 1: - damage = (int)((double)damage * 4.0); //BoC - break; - case 2: - damage = (int)((double)damage * 4.0); //King Slime - break; - case 3: - damage = (int)((double)damage * 6.0); //EoC - break; - case 4: - damage = (int)((double)damage * 2.5); //Prime - break; - case 5: - damage = (int)((double)damage * 2.5); //Golem - break; - case 6: - damage = (int)((double)damage * 1.75); //Guardians - break; - case 7: - damage = (int)((double)damage * 5.0); //EoW - break; - case 8: - damage = (int)((double)damage * 2.0); //Tier 2 Astrageldon values adjusted for a median of 300 damage - break; - case 9: - damage = (int)((double)damage * 3.0); //Destroyer - break; - case 10: - damage = (int)((double)damage * 3.0); //Twins - break; - case 11: - damage = (int)((double)damage * 1.0); //Birb - break; - case 12: - damage = (int)((double)damage * 4.0); //WoF - break; - case 13: - damage = (int)((double)damage * 4.5); //Hive Mind - break; - case 14: - damage = (int)((double)damage * 4.0); //Skeletron - break; - case 15: - damage = (int)((double)damage * 1.25); //Storm Weaver - break; - case 16: - damage = (int)((double)damage * 3.0); //Tier 3 Aquatic Scourge values adjusted for a median of 350 damage - break; - case 17: - damage = (int)((double)damage * 6.0); //Desert Scourge - break; - case 18: - damage = (int)((double)damage * 3.5); //Cultist - break; - case 19: - damage = (int)((double)damage * 4.5); //Crabulon - break; - case 20: - damage = (int)((double)damage * 3.5); //Plantera - break; - case 21: - damage = (int)((double)damage * 2.0); //Void - break; - case 22: - damage = (int)((double)damage * 5.0); //Perfs - break; - case 23: - damage = (int)((double)damage * 4.0); //Cryogen - break; - case 24: - damage = (int)((double)damage * 4.0); //Tier 4 Brimstone Elemental values adjusted for a median of 400 damage - break; - case 25: - damage = (int)((double)damage * 2.0); //Signus - break; - case 26: - damage = (int)((double)damage * 2.5); //Ravager - break; - case 27: - damage = (int)((double)damage * 2.0); //Fishron - break; - case 28: - damage = (int)((double)damage * 2.5); //Moon Lord - break; - case 29: - damage = (int)((double)damage * 2.75); //Astrum Deus - break; - case 30: - damage = (int)((double)damage * 2.0); //Polter - break; - case 31: - damage = (int)((double)damage * 2.5); //Plaguebringer - break; - case 32: - damage = (int)((double)damage * 4.0); //Tier 5 Calamitas values adjusted for a median of 450 to 500 damage - break; - case 33: - damage = (int)((double)damage * 3.75); //Levi and Siren - break; - case 34: - damage = (int)((double)damage * 5.25); //Slime God - break; - case 35: - damage = (int)((double)damage * 2.5); //Providence - break; - case 36: - damage = (int)((double)damage * 1.0); //SCal - break; - case 37: - damage = (int)((double)damage * 1.1); //Yharon - break; - case 38: - damage = (int)((double)damage * 2.0); //DoG - break; - } - } - if (enraged) - { - damage = (int)((double)damage * 1.25); - } - if (CalamityWorld.revenge) - { - if (player.chaosState && !normalityRelocator) - { - damage = (int)((double)damage * 1.5); //ono - } - if (player.ichor) - { - damage = (int)((double)damage * 1.25); - } - else if (player.onFire2) - { - damage = (int)((double)damage * 1.2); - } - customDamage = true; - float damageMult = CalamityWorld.downedBossAny ? 1f : 0.8f; - if (CalamityWorld.death) - { - damageMult = 1.25f; - } - damage = (int)((double)damage * damageMult); - double newDamage = (double)damage - (double)player.statDefense * (Main.hardMode ? 0.75 : 0.5); - double newDamageLimit = 5.0 + (Main.hardMode ? 5.0 : 0.0) + (NPC.downedPlantBoss ? 5.0 : 0.0) + (NPC.downedMoonlord ? 5.0 : 0.0); //5, 10, 15, 20 - if (newDamage < newDamageLimit) - { - newDamage = newDamageLimit; - } - damage = (int)newDamage; - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(4) == 0) - { - damage = (int)((double)damage * 3.0); - } - } - if (bloodPact) - { - if (Main.rand.Next(4) == 0) - { - damage = (int)((double)damage * 3.0); - } - } - if (godSlayerDamage && damage <= 80) - { - damage = 1; - } + if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) { playSound = false; @@ -6730,22 +7863,200 @@ namespace CalamityMod playSound = false; Main.PlaySound(20, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); //female hit noise } + + #region MultiplierBoosts + double damageMult = 1.0 + + (dArtifact ? 0.25 : 0.0) + + ((player.beetleDefense && player.beetleOrbs > 0) ? (0.05 * (double)player.beetleOrbs) : 0.0) + + (enraged ? 0.25 : 0.0) + + ((CalamityWorld.defiled && Main.rand.Next(4) == 0) ? 0.5 : 0.0) + + ((bloodPact && Main.rand.Next(4) == 0) ? 1.5 : 0.0); + + if (CalamityWorld.revenge) + { + if (player.chaosState) + damageMult += 0.5; + if (CalamityWorld.death) + damageMult += 0.25; + if (player.ichor) + damageMult += 0.25; + else if (player.onFire2) + damageMult += 0.2; + } + + if (CalamityWorld.bossRushActive) + { + switch (CalamityWorld.bossRushStage) + { + case 0: + damageMult += 4.0; //Tier 1 Queen Bee values adjusted for a median of 250 damage + break; + case 1: + damageMult += 3.0; //BoC + break; + case 2: + damageMult += 3.0; //King Slime + break; + case 3: + damageMult += 5.0; //EoC + break; + case 4: + damageMult += 1.5; //Prime + break; + case 5: + damageMult += 1.5; //Golem + break; + case 6: + damageMult += 0.75; //Guardians + break; + case 7: + damageMult += 4.0; //EoW + break; + case 8: + damageMult += 1.0; //Tier 2 Astrageldon values adjusted for a median of 300 damage + break; + case 9: + damageMult += 2.0; //Destroyer + break; + case 10: + damageMult += 2.0; //Twins + break; + case 11: + //Birb + break; + case 12: + damageMult += 3.0; //WoF + break; + case 13: + damageMult += 3.5; //Hive Mind + break; + case 14: + damageMult += 3.0; //Skeletron + break; + case 15: + damageMult += 0.25; //Storm Weaver + break; + case 16: + damageMult += 2.0; //Tier 3 Aquatic Scourge values adjusted for a median of 350 damage + break; + case 17: + damageMult += 5.0; //Desert Scourge + break; + case 18: + damageMult += 2.5; //Cultist + break; + case 19: + damageMult += 3.5; //Crabulon + break; + case 20: + damageMult += 2.5; //Plantera + break; + case 21: + damageMult += 1.0; //Void + break; + case 22: + damageMult += 4.0; //Perfs + break; + case 23: + damageMult += 3.0; //Cryogen + break; + case 24: + damageMult += 3.0; //Tier 4 Brimstone Elemental values adjusted for a median of 400 damage + break; + case 25: + damageMult += 1.0; //Signus + break; + case 26: + damageMult += 1.5; //Ravager + break; + case 27: + damageMult += 1.0; //Fishron + break; + case 28: + damageMult += 1.5; //Moon Lord + break; + case 29: + damageMult += 1.75; //Astrum Deus + break; + case 30: + damageMult += 1.0; //Polter + break; + case 31: + damageMult += 1.5; //Plaguebringer + break; + case 32: + damageMult += 3.0; //Tier 5 Calamitas values adjusted for a median of 450 to 500 damage + break; + case 33: + damageMult += 2.75; //Levi and Siren + break; + case 34: + damageMult += 4.25; //Slime God + break; + case 35: + damageMult += 1.5; //Providence + break; + case 36: + //SCal + break; + case 37: + damageMult += 0.1; //Yharon + break; + case 38: + damageMult += 1.0; //DoG + break; + } + } + damage = (int)((double)damage * damageMult); + #endregion + + if (CalamityWorld.revenge) + { + customDamage = true; + double defenseMult = Main.hardMode ? 0.75 : 0.5; + double newDamage = (double)damage - ((double)player.statDefense * defenseMult); + double newDamageLimit = 5.0 + (Main.hardMode ? 5.0 : 0.0) + (NPC.downedPlantBoss ? 5.0 : 0.0) + (NPC.downedMoonlord ? 5.0 : 0.0); //5, 10, 15, 20 + if (newDamage < newDamageLimit) + { + newDamage = newDamageLimit; + } + damage = (int)newDamage; + } + + #region MultiplicativeReductions + if (trinketOfChiBuff) + { + damage = (int)((double)damage * 0.85); + } + if (purpleCandle) + { + damage = (int)((double)damage - ((double)player.statDefense * 0.05)); + } if (abyssalDivingSuitPlates) { damage = (int)((double)damage * 0.85); } if (sirenIce) { - damage = (int)((double)damage * 0.8); + damage = (int)((double)damage * 0.85); } - if (auricSet || silvaSet) + if (CalamityWorld.revenge) { - damage = (int)((double)damage * 0.95); + if (!CalamityWorld.downedBossAny) + damage = (int)((double)damage * 0.8); } - if (purpleCandle) + if (player.mount.Active && (player.mount.Type == mod.MountType("AngryDog") || player.mount.Type == mod.MountType("OnyxExcavator")) && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) { - damage = (int)((double)damage - ((double)player.statDefense * 0.05)); + damage = (int)((double)damage * 0.9); } + #endregion + + if ((godSlayerDamage && damage <= 80) || damage < 1) + { + damage = 1; + } + + #region HealingEffects if (revivifyTimer > 0) { int healAmt = damage / 20; @@ -6764,14 +8075,8 @@ namespace CalamityMod player.statLife += healAmt; player.HealEffect(healAmt); } - if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) - { - int newDamageLimit = 300; - if (damage < newDamageLimit) - { - damage = newDamageLimit; - } - } + #endregion + return true; } @@ -6795,7 +8100,7 @@ namespace CalamityMod { adrenaline = 0; } - if (gShell && !player.panic) + if ((gShell || fabledTortoise) && !player.panic) { player.AddBuff(mod.BuffType("ShellBoost"), 300); } @@ -7036,6 +8341,10 @@ namespace CalamityMod player.immuneTime += 10; } } + if (CalamityWorld.bossRushActive && Config.BossRushImmunityFrameCurse) + { + bossRushImmunityFrameCurseTimer = 300 + player.immuneTime; + } if (damage > 25) { if (aeroSet) @@ -7059,7 +8368,13 @@ namespace CalamityMod } if (aBulwark) { - for (int n = 0; n < 4; n++) + if (aBulwarkRare) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 74); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("GodSlayerBlaze"), 25, 5f, player.whoAmI, 0f, 0f); + } + int starAmt = aBulwarkRare ? 12 : 5; + for (int n = 0; n < starAmt; n++) { float x = player.position.X + (float)Main.rand.Next(-400, 400); float y = player.position.Y - (float)Main.rand.Next(500, 800); @@ -7134,6 +8449,8 @@ namespace CalamityMod double offsetAngle; int i; int sDamage = hardMode ? 36 : 6; + if (aSparkRare) + sDamage += hardMode ? 12 : 2; if (player.whoAmI == Main.myPlayer) { for (i = 0; i < 4; i++) @@ -7285,6 +8602,11 @@ namespace CalamityMod #region KillPlayer public void KillPlayer() { + deathCount++; + if (player.whoAmI == Main.myPlayer && Main.netMode == 1) + { + DeathPacket(false); + } player.lastDeathPostion = player.Center; player.lastDeathTime = DateTime.Now; player.showLastDeath = true; @@ -7412,6 +8734,54 @@ namespace CalamityMod #region DashStuff public void ModDashMovement() { + if (dashMod == 6 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) + { + Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].immune[player.whoAmI] <= 0) + { + NPC nPC = Main.npc[i]; + Rectangle rect = nPC.getRect(); + if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + { + float num = 50f * player.meleeDamage; + float num2 = 3f; + bool crit = false; + if (player.kbGlove) + { + num2 *= 2f; + } + if (player.kbBuff) + { + num2 *= 1.5f; + } + if (Main.rand.Next(100) < player.meleeCrit) + { + crit = true; + } + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + if (player.velocity.X > 0f) + { + direction = 1; + } + if (player.whoAmI == Main.myPlayer) + { + player.ApplyDamageToNPC(nPC, (int)num, num2, direction, crit); + } + nPC.immune[player.whoAmI] = 6; + nPC.AddBuff(mod.BuffType("GlacialState"), 300); + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime = 4; + } + } + } + } if (dashMod == 4 && player.dashDelay < 0 && player.whoAmI == Main.myPlayer) { Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); @@ -7668,6 +9038,38 @@ namespace CalamityMod } num7 = 16f; //14 } + else if (dashMod == 5) + { + for (int m = 0; m < 24; m++) + { + int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 33, 0f, 0f, 100, default(Color), 2.75f); + Main.dust[num14].velocity *= 0.1f; + Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].noGravity = true; + if (Main.rand.Next(2) == 0) + { + Main.dust[num14].fadeIn = 0.5f; + } + } + num7 = 18f; //14 + } + else if (dashMod == 6) + { + for (int m = 0; m < 24; m++) + { + int num14 = Dust.NewDust(new Vector2(player.position.X, player.position.Y + 4f), player.width, player.height - 8, 67, 0f, 0f, 100, default(Color), 1f); + Main.dust[num14].velocity *= 0.1f; + Main.dust[num14].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num14].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num14].noGravity = true; + if (Main.rand.Next(2) == 0) + { + Main.dust[num14].fadeIn = 0.5f; + } + } + num7 = 12.5f; //14 + } if (dashMod > 0) { player.vortexStealthActive = false; @@ -7947,6 +9349,132 @@ namespace CalamityMod } } } + else if (dashMod == 5) + { + int num23 = 0; + bool flag3 = false; + if (dashTimeMod > 0) + { + dashTimeMod--; + } + if (dashTimeMod < 0) + { + dashTimeMod++; + } + if (player.controlRight && player.releaseRight) + { + if (dashTimeMod > 0) + { + num23 = 1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = 15; + } + } + else if (player.controlLeft && player.releaseLeft) + { + if (dashTimeMod < 0) + { + num23 = -1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = -15; + } + } + if (flag3) + { + player.velocity.X = 25.9f * (float)num23; + Point point5 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); + Point point6 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), 0f)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) + { + player.velocity.X = player.velocity.X / 2f; + } + player.dashDelay = -1; + for (int num24 = 0; num24 < 60; num24++) + { + int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 33, 0f, 0f, 100, default(Color), 3f); + Dust expr_13AF_cp_0 = Main.dust[num25]; + expr_13AF_cp_0.position.X = expr_13AF_cp_0.position.X + (float)Main.rand.Next(-5, 6); + Dust expr_13D6_cp_0 = Main.dust[num25]; + expr_13D6_cp_0.position.Y = expr_13D6_cp_0.position.Y + (float)Main.rand.Next(-5, 6); + Main.dust[num25].velocity *= 0.2f; + Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num25].noGravity = true; + Main.dust[num25].fadeIn = 0.5f; + } + } + } + else if (dashMod == 6) + { + int num23 = 0; + bool flag3 = false; + if (dashTimeMod > 0) + { + dashTimeMod--; + } + if (dashTimeMod < 0) + { + dashTimeMod++; + } + if (player.controlRight && player.releaseRight) + { + if (dashTimeMod > 0) + { + num23 = 1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = 15; + } + } + else if (player.controlLeft && player.releaseLeft) + { + if (dashTimeMod < 0) + { + num23 = -1; + flag3 = true; + dashTimeMod = 0; + } + else + { + dashTimeMod = -15; + } + } + if (flag3) + { + player.velocity.X = 15.7f * (float)num23; + Point point5 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), player.gravDir * (float)(-(float)player.height) / 2f + player.gravDir * 2f)).ToTileCoordinates(); + Point point6 = (player.Center + new Vector2((float)(num23 * player.width / 2 + 2), 0f)).ToTileCoordinates(); + if (WorldGen.SolidOrSlopedTile(point5.X, point5.Y) || WorldGen.SolidOrSlopedTile(point6.X, point6.Y)) + { + player.velocity.X = player.velocity.X / 2f; + } + player.dashDelay = -1; + for (int num24 = 0; num24 < 60; num24++) + { + int num25 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 67, 0f, 0f, 100, default(Color), 1.25f); + Dust expr_13AF_cp_0 = Main.dust[num25]; + expr_13AF_cp_0.position.X = expr_13AF_cp_0.position.X + (float)Main.rand.Next(-5, 6); + Dust expr_13D6_cp_0 = Main.dust[num25]; + expr_13D6_cp_0.position.Y = expr_13D6_cp_0.position.Y + (float)Main.rand.Next(-5, 6); + Main.dust[num25].velocity *= 0.2f; + Main.dust[num25].scale *= 1f + (float)Main.rand.Next(20) * 0.01f; + Main.dust[num25].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + Main.dust[num25].noGravity = true; + Main.dust[num25].fadeIn = 0.5f; + } + } + } } } @@ -8029,6 +9557,20 @@ namespace CalamityMod Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } + else if (dashMod == 5) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 33, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default(Color), 3f); + Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; + Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 6) + { + int num7 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num3), player.width + 8, 4, 67, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default(Color), 1.25f); + Main.dust[num7].velocity.X = Main.dust[num7].velocity.X * 0.2f; + Main.dust[num7].velocity.Y = Main.dust[num7].velocity.Y * 0.2f; + Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } } } else if (player.controlRight && player.velocity.X < player.accRunSpeed && player.dashDelay >= 0) @@ -8068,8 +9610,103 @@ namespace CalamityMod Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); } + else if (dashMod == 5) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 33, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default(Color), 3f); + Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; + Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } + else if (dashMod == 6) + { + int num12 = Dust.NewDust(new Vector2(player.position.X - 4f, player.position.Y + (float)player.height + (float)num8), player.width + 8, 4, 67, -player.velocity.X * 0.5f, player.velocity.Y * 0.5f, 50, default(Color), 1.25f); + Main.dust[num12].velocity.X = Main.dust[num12].velocity.X * 0.2f; + Main.dust[num12].velocity.Y = Main.dust[num12].velocity.Y * 0.2f; + Main.dust[num12].shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player); + } } } + if (player.mount.Active && player.mount.Type == mod.MountType("Fab") && Math.Abs(player.velocity.X) > player.mount.DashSpeed - player.mount.RunSpeed / 2f) + { + Rectangle rect = player.getRect(); + if (player.direction == 1) + { + rect.Offset(player.width - 1, 0); + } + rect.Width = 2; + rect.Inflate(6, 12); + float damage = 800f * player.minionDamage; + float knockback = 10f; + int nPCImmuneTime = 30; + int playerImmuneTime = 6; + ModCollideWithNPCs(rect, damage, knockback, nPCImmuneTime, playerImmuneTime); + } + if (player.mount.Active && player.mount.Type == mod.MountType("AngryDog") && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) + { + Rectangle rect2 = player.getRect(); + if (player.direction == 1) + { + rect2.Offset(player.width - 1, 0); + } + rect2.Width = 2; + rect2.Inflate(6, 12); + float damage2 = 50f * player.minionDamage; + float knockback2 = 8f; + int nPCImmuneTime2 = 30; + int playerImmuneTime2 = 6; + ModCollideWithNPCs(rect2, damage2, knockback2, nPCImmuneTime2, playerImmuneTime2); + } + if (player.mount.Active && player.mount.Type == mod.MountType("OnyxExcavator") && Math.Abs(player.velocity.X) > player.mount.RunSpeed / 2f) + { + Rectangle rect2 = player.getRect(); + if (player.direction == 1) + { + rect2.Offset(player.width - 1, 0); + } + rect2.Width = 2; + rect2.Inflate(6, 12); + float damage2 = 25f * player.minionDamage; + float knockback2 = 5f; + int nPCImmuneTime2 = 30; + int playerImmuneTime2 = 6; + ModCollideWithNPCs(rect2, damage2, knockback2, nPCImmuneTime2, playerImmuneTime2); + } + } + + private int ModCollideWithNPCs(Rectangle myRect, float Damage, float Knockback, int NPCImmuneTime, int PlayerImmuneTime) + { + int num = 0; + for (int i = 0; i < 200; i++) + { + NPC nPC = Main.npc[i]; + if (nPC.active && !nPC.dontTakeDamage && !nPC.friendly && nPC.immune[player.whoAmI] == 0) + { + Rectangle rect = nPC.getRect(); + if (myRect.Intersects(rect) && (nPC.noTileCollide || Collision.CanHit(player.position, player.width, player.height, nPC.position, nPC.width, nPC.height))) + { + int direction = player.direction; + if (player.velocity.X < 0f) + { + direction = -1; + } + if (player.velocity.X > 0f) + { + direction = 1; + } + if (player.whoAmI == Main.myPlayer) + { + player.ApplyDamageToNPC(nPC, (int)Damage, Knockback, direction, false); + } + nPC.immune[player.whoAmI] = NPCImmuneTime; + player.immune = true; + player.immuneNoBlink = true; + player.immuneTime = PlayerImmuneTime; + num++; + break; + } + } + } + return num; } #endregion @@ -8241,14 +9878,18 @@ namespace CalamityMod list.Insert(0, MiscEffectsBack); MiscEffects.visible = true; list.Add(MiscEffects); - if (fab) { AddPlayerLayer(list, clAfterAll, list[list.Count - 1], false); } + if (fab || crysthamyr || onyxExcavator) { AddPlayerLayer(list, clAfterAll, list[list.Count - 1], false); } } public PlayerLayer clAfterAll = new PlayerLayer("Calamity", "clAfterAll", PlayerLayer.MiscEffectsFront, delegate (PlayerDrawInfo edi) { Mod mod = ModLoader.GetMod("CalamityMod"); Player drawPlayer = edi.drawPlayer; - if (drawPlayer.mount != null && drawPlayer.GetModPlayer(mod).fab) { drawPlayer.mount.Draw(Main.playerDrawData, 3, drawPlayer, edi.position, edi.mountColor, edi.spriteEffects, edi.shadow); } + if (drawPlayer.mount != null && (drawPlayer.GetModPlayer(mod).fab || drawPlayer.GetModPlayer(mod).crysthamyr || + drawPlayer.GetModPlayer(mod).onyxExcavator)) + { + drawPlayer.mount.Draw(Main.playerDrawData, 3, drawPlayer, edi.position, edi.mountColor, edi.spriteEffects, edi.shadow); + } }); public static void AddPlayerLayer(List list, PlayerLayer layer, PlayerLayer parent, bool first) @@ -8736,6 +10377,22 @@ namespace CalamityMod } } + private void DeathPacket(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.DeathCountSync); + packet.Write(player.whoAmI); + packet.Write(deathCount); + if (!server) + { + packet.Send(); + } + else + { + packet.Send(-1, player.whoAmI); + } + } + internal void HandleExactLevels(BinaryReader reader, int levelType) { switch (levelType) @@ -8806,6 +10463,15 @@ namespace CalamityMod } } + internal void HandleDeathCount(BinaryReader reader) + { + deathCount = reader.ReadInt32(); + if (Main.netMode == 2) + { + DeathPacket(true); + } + } + public override void OnEnterWorld(Player player) { if (Main.netMode == 1) @@ -8822,6 +10488,7 @@ namespace CalamityMod LevelPacket(false, 4); StressPacket(false); AdrenalinePacket(false); + DeathPacket(false); } } #endregion diff --git a/CalamityWorld.cs b/CalamityWorld.cs index f5a63b5677..88d5dd84ae 100644 --- a/CalamityWorld.cs +++ b/CalamityWorld.cs @@ -50,19 +50,19 @@ namespace CalamityMod public static bool ironHeart = false; //Iron Heart Mode //Evil Islands - private static int fehX = 0; - private static int fehY = 0; + public static int fehX = 0; + public static int fehY = 0; //Brimstone Crag - private static int fuhX = 0; - private static int fuhY = 0; + public static int fuhX = 0; + public static int fuhY = 0; public static int calamityTiles = 0; //Abyss & Sulphur - private static int numAbyssIslands = 0; - private static int[] AbyssIslandX = new int[20]; - private static int[] AbyssIslandY = new int[20]; - private static int[] AbyssItemArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + public static int numAbyssIslands = 0; + public static int[] AbyssIslandX = new int[20]; + public static int[] AbyssIslandY = new int[20]; + public static int[] AbyssItemArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; public static int sulphurTiles = 0; public static int abyssTiles = 0; public static bool abyssSide = false; @@ -79,21 +79,21 @@ namespace CalamityMod public static Rectangle SunkenSeaLocation = Rectangle.Empty; //Ice Tomb - private static bool genIcePyramid = true; + public static bool genIcePyramid = true; //Shrines - private static int[] SChestX = new int[10]; - private static int[] SChestY = new int[10]; - private static bool genHellHut = true; - private static bool genSandHut = true; - private static bool genEvilHut = true; - private static bool genPureHut = true; //forest - private static bool genIceHut = true; - private static bool genMushroomHut = true; - private static bool genGraniteHut = true; - private static bool genMarbleHut = true; - private static bool genSwordHut = true; - private static bool genAbyssHut = true; + public static int[] SChestX = new int[10]; + public static int[] SChestY = new int[10]; + public static bool genHellHut = true; + public static bool genSandHut = true; + public static bool genEvilHut = true; + public static bool genPureHut = true; //forest + public static bool genIceHut = true; + public static bool genMushroomHut = true; + public static bool genGraniteHut = true; + public static bool genMarbleHut = true; + public static bool genSwordHut = true; + public static bool genAbyssHut = true; #region Downed Bools public static bool downedBossAny = false; //Any boss @@ -614,18 +614,18 @@ namespace CalamityMod #region PreWorldGen public override void PreWorldGen() { - CalamityWorld.numAbyssIslands = 0; - CalamityWorld.genIcePyramid = true; - CalamityWorld.genHellHut = true; - CalamityWorld.genSandHut = true; - CalamityWorld.genEvilHut = true; - CalamityWorld.genPureHut = true; - CalamityWorld.genIceHut = true; - CalamityWorld.genMushroomHut = true; - CalamityWorld.genGraniteHut = true; - CalamityWorld.genMarbleHut = true; - CalamityWorld.genSwordHut = true; - CalamityWorld.genAbyssHut = true; + numAbyssIslands = 0; + genIcePyramid = true; + genHellHut = true; + genSandHut = true; + genEvilHut = true; + genPureHut = true; + genIceHut = true; + genMushroomHut = true; + genGraniteHut = true; + genMarbleHut = true; + genSwordHut = true; + genAbyssHut = true; } #endregion @@ -635,7 +635,8 @@ namespace CalamityMod int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies")); if (ShiniesIndex != -1) { - tasks.Insert(ShiniesIndex + 1, new PassLegacy("CalamityOres", delegate (GenerationProgress progress) + #region IceTomb + tasks.Insert(ShiniesIndex + 1, new PassLegacy("IceTomb", delegate (GenerationProgress progress) { progress.Message = "Ice Tomb"; int x = Main.maxTilesX; @@ -644,26 +645,30 @@ namespace CalamityMod int generateBack = genLimit - 80; //Small = 2020 int generateForward = genLimit + 80; //Small = 2180 - #region IceTomb for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) { int tilesX = WorldGen.genRand.Next(0, generateBack); int tilesX2 = WorldGen.genRand.Next(generateForward, x); int tilesY2 = WorldGen.genRand.Next((int)(y * .4f), (int)(y * .5f)); - if ((Main.tile[tilesX, tilesY2].type == TileID.SnowBlock || Main.tile[tilesX, tilesY2].type == TileID.IceBlock) && CalamityWorld.genIcePyramid) + if ((Main.tile[tilesX, tilesY2].type == TileID.SnowBlock || Main.tile[tilesX, tilesY2].type == TileID.IceBlock) && genIcePyramid) { - CalamityWorld.genIcePyramid = false; - IcePyramid(tilesX, tilesY2); + genIcePyramid = false; + WorldGenerationMethods.IcePyramid(tilesX, tilesY2); } - if ((Main.tile[tilesX2, tilesY2].type == TileID.SnowBlock || Main.tile[tilesX2, tilesY2].type == TileID.IceBlock) && CalamityWorld.genIcePyramid) + if ((Main.tile[tilesX2, tilesY2].type == TileID.SnowBlock || Main.tile[tilesX2, tilesY2].type == TileID.IceBlock) && genIcePyramid) { - CalamityWorld.genIcePyramid = false; - IcePyramid(tilesX2, tilesY2); + genIcePyramid = false; + WorldGenerationMethods.IcePyramid(tilesX2, tilesY2); } } - #endregion + })); + #endregion - #region EvilIslandGen + #region EvilIsland + tasks.Insert(ShiniesIndex + 2, new PassLegacy("EvilIsland", delegate (GenerationProgress progress) + { + progress.Message = "Evil Island"; + int x = Main.maxTilesX; int xIslandGen = WorldGen.crimson ? WorldGen.genRand.Next((int)((double)x * 0.15), (int)((double)x * 0.2)) : WorldGen.genRand.Next((int)((double)x * 0.8), (int)((double)x * 0.85)); @@ -673,34 +678,42 @@ namespace CalamityMod if (WorldGen.crimson) { while (Main.tile[tileXLookup, yIslandGen].active()) - { tileXLookup++; - } } else { while (Main.tile[tileXLookup, yIslandGen].active()) - { tileXLookup--; - } } xIslandGen = tileXLookup; - CalamityWorld.fehX = xIslandGen; - CalamityWorld.fehY = yIslandGen; - EvilIsland(xIslandGen, yIslandGen); - EvilIslandHouse(CalamityWorld.fehX, CalamityWorld.fehY); - #endregion + fehX = xIslandGen; + fehY = yIslandGen; + WorldGenerationMethods.EvilIsland(xIslandGen, yIslandGen); + WorldGenerationMethods.EvilIslandHouse(fehX, fehY); + })); + #endregion + } + int DungeonChestIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon")); + if (DungeonChestIndex != -1) + { + tasks.Insert(DungeonChestIndex + 1, new PassLegacy("Calamity Mod: Biome Chests", WorldGenerationMethods.GenerateBiomeChests)); + } + + int WaterFromSandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Remove Water From Sand")); + if (WaterFromSandIndex != -1) + { + tasks.Insert(WaterFromSandIndex + 1, new PassLegacy("SunkenSea", delegate (GenerationProgress progress) + { + progress.Message = "Making the world more wet"; + SunkenSea.Place(new Point(WorldGen.UndergroundDesertLocation.Left, WorldGen.UndergroundDesertLocation.Bottom)); })); } - int dungeonChestIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon")); - if (dungeonChestIndex != -1) - { - tasks.Insert(dungeonChestIndex + 1, new PassLegacy("Calamity Mod: Biome Chests", GenerateBiomeChests)); - } + int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); if (SulphurIndex != -1) { + #region Sulphur tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur", delegate (GenerationProgress progress) { progress.Message = "Sulphur Beach"; @@ -713,7 +726,6 @@ namespace CalamityMod int abyssChasmX = (abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); //2100 - 1965 = 135 : 2100 + 1965 = 4065 - #region SulphurGen if (abyssSide) { for (int abyssIndexSand = 0; abyssIndexSand < abyssChasmX + 240; abyssIndexSand++) @@ -816,35 +828,182 @@ namespace CalamityMod } } } - #endregion - })); + #endregion } + int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); if (FinalIndex != -1) { - tasks.Insert(FinalIndex + 1, new PassLegacy("SunkenSea", delegate (GenerationProgress progress) + #region BrimstoneCrag + tasks.Insert(FinalIndex + 1, new PassLegacy("BrimstoneCrag", delegate (GenerationProgress progress) { - progress.Message = "Making the world more wet"; - SunkenSea.Place(new Point(WorldGen.UndergroundDesertLocation.Left, WorldGen.UndergroundDesertLocation.Bottom)); - })); + progress.Message = "Brimstone Crag"; - tasks.Insert(FinalIndex + 2, new PassLegacy("HellCrag", delegate (GenerationProgress progress) + int x = Main.maxTilesX; + + int xUnderworldGen = WorldGen.genRand.Next((int)((double)x * 0.1), (int)((double)x * 0.15)); + int yUnderworldGen = Main.maxTilesY - 100; + + fuhX = xUnderworldGen; + fuhY = yUnderworldGen; + + WorldGenerationMethods.UnderworldIsland(xUnderworldGen, yUnderworldGen, 180, 201, 120, 136); + WorldGenerationMethods.UnderworldIsland(xUnderworldGen - 50, yUnderworldGen - 30, 100, 111, 60, 71); + WorldGenerationMethods.UnderworldIsland(xUnderworldGen + 50, yUnderworldGen - 30, 100, 111, 60, 71); + + WorldGenerationMethods.ChasmGenerator(fuhX - 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); + WorldGenerationMethods.ChasmGenerator(fuhX + 110, fuhY - 10, WorldGen.genRand.Next(150) + 150); + + WorldGenerationMethods.UnderworldIsland(xUnderworldGen - 150, yUnderworldGen - 30, 60, 66, 35, 41); + WorldGenerationMethods.UnderworldIsland(xUnderworldGen + 150, yUnderworldGen - 30, 60, 66, 35, 41); + WorldGenerationMethods.UnderworldIsland(xUnderworldGen - 180, yUnderworldGen - 20, 60, 66, 35, 41); + WorldGenerationMethods.UnderworldIsland(xUnderworldGen + 180, yUnderworldGen - 20, 60, 66, 35, 41); + + WorldGenerationMethods.UnderworldIslandHouse(fuhX, fuhY + 30, 1323); + WorldGenerationMethods.UnderworldIslandHouse(fuhX - 22, fuhY + 15, 1322); + WorldGenerationMethods.UnderworldIslandHouse(fuhX + 22, fuhY + 15, 535); + WorldGenerationMethods.UnderworldIslandHouse(fuhX - 50, fuhY - 30, 112); + WorldGenerationMethods.UnderworldIslandHouse(fuhX + 50, fuhY - 30, 906); + WorldGenerationMethods.UnderworldIslandHouse(fuhX - 150, fuhY - 30, 218); + WorldGenerationMethods.UnderworldIslandHouse(fuhX + 150, fuhY - 30, 3019); + WorldGenerationMethods.UnderworldIslandHouse(fuhX - 180, fuhY - 20, 274); + WorldGenerationMethods.UnderworldIslandHouse(fuhX + 180, fuhY - 20, 220); + })); + #endregion + + #region SpecialShrines + tasks.Insert(FinalIndex + 2, new PassLegacy("SpecialShrines", delegate (GenerationProgress progress) { - progress.Message = "Brimstone Crag, Abyss, and Structures"; + progress.Message = "Special Shrines"; int x = Main.maxTilesX; int y = Main.maxTilesY; int genLimit = x / 2; int generateBack = genLimit - 80; //Small = 2020 int generateForward = genLimit + 80; //Small = 2180 + + for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) + { + int tilesX = WorldGen.genRand.Next(0, generateBack); + int tilesX2 = WorldGen.genRand.Next(generateForward, x); + int tilesX3 = WorldGen.genRand.Next((int)((double)x * 0.3), generateBack); + int tilesX4 = WorldGen.genRand.Next(generateForward, (int)((double)x * 0.6)); + int tilesX5 = WorldGen.genRand.Next((int)((double)x * 0.97), (int)((double)x * 0.98)); + int tilesY3 = WorldGen.genRand.Next((int)(y * .3f), (int)(y * .35f)); + int tilesY4 = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); + int tilesY5 = WorldGen.genRand.Next((int)(y * .55f), (int)(y * .8f)); + int tilesY6 = y - 60; + if ((Main.tile[tilesX3, tilesY3].type == TileID.Dirt || Main.tile[tilesX3, tilesY3].type == TileID.Stone) && genPureHut) + { + genPureHut = false; + WorldGenerationMethods.SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX3, tilesY3); //red brick, dirt, red brick wall + } + if ((Main.tile[tilesX4, tilesY3].type == TileID.Dirt || Main.tile[tilesX4, tilesY3].type == TileID.Stone) && genPureHut) + { + genPureHut = false; + WorldGenerationMethods.SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX4, tilesY3); + } + if (Main.tile[tilesX, tilesY3].type == (WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone) && genEvilHut) + { + genEvilHut = false; + WorldGenerationMethods.SpecialHut(WorldGen.crimson ? TileID.CrimtaneBrick : TileID.DemoniteBrick, + WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone, + WorldGen.crimson ? WallID.CrimtaneBrick : WallID.DemoniteBrick, 1, tilesX, tilesY3); //crimstone brick, crimstone, crimstone brick wall + } + if (Main.tile[tilesX2, tilesY3].type == (WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone) && genEvilHut) + { + genEvilHut = false; + WorldGenerationMethods.SpecialHut(WorldGen.crimson ? TileID.CrimtaneBrick : TileID.DemoniteBrick, + WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone, + WorldGen.crimson ? WallID.CrimtaneBrick : WallID.DemoniteBrick, 1, tilesX2, tilesY3); + } + if (Main.tile[tilesX3, tilesY5].type == TileID.Stone && genHellHut) + { + genHellHut = false; + WorldGenerationMethods.SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, 2, tilesX3, tilesY5); //obsidian brick, obsidian, obsidian brick wall + } + if (Main.tile[tilesX4, tilesY5].type == TileID.Stone && genHellHut) + { + genHellHut = false; + WorldGenerationMethods.SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, 2, tilesX4, tilesY5); + } + if (Main.tile[tilesX, tilesY4].type == TileID.IceBlock && genIceHut) + { + genIceHut = false; + WorldGenerationMethods.SpecialHut(TileID.IceBrick, TileID.IceBlock, WallID.IceBrick, 3, tilesX, tilesY4); + } + if (Main.tile[tilesX2, tilesY4].type == TileID.IceBlock && genIceHut) + { + genIceHut = false; + WorldGenerationMethods.SpecialHut(TileID.IceBrick, TileID.IceBlock, WallID.IceBrick, 3, tilesX2, tilesY4); + } + if (Main.tile[tilesX, tilesY4].type == TileID.DesertFossil && genSandHut) + { + genSandHut = false; + WorldGenerationMethods.SpecialHut(TileID.DesertFossil, TileID.Sandstone, WallID.DesertFossil, 4, tilesX, tilesY4); + } + if (Main.tile[tilesX2, tilesY4].type == TileID.DesertFossil && genSandHut) + { + genSandHut = false; + WorldGenerationMethods.SpecialHut(TileID.DesertFossil, TileID.Sandstone, WallID.DesertFossil, 4, tilesX2, tilesY4); + } + if (Main.tile[tilesX3, tilesY4].type == TileID.MushroomGrass && genMushroomHut) + { + genMushroomHut = false; + WorldGenerationMethods.SpecialHut(TileID.MushroomBlock, TileID.Mud, WallID.MushroomUnsafe, 5, tilesX3, tilesY4); + } + if (Main.tile[tilesX4, tilesY4].type == TileID.MushroomGrass && genMushroomHut) + { + genMushroomHut = false; + WorldGenerationMethods.SpecialHut(TileID.MushroomBlock, TileID.Mud, WallID.MushroomUnsafe, 5, tilesX4, tilesY4); + } + if (Main.tile[tilesX, tilesY4].type == TileID.Granite && genGraniteHut) + { + genGraniteHut = false; + WorldGenerationMethods.SpecialHut(TileID.GraniteBlock, TileID.Granite, WallID.GraniteUnsafe, 6, tilesX, tilesY4); + } + if (Main.tile[tilesX2, tilesY4].type == TileID.Granite && genGraniteHut) + { + genGraniteHut = false; + WorldGenerationMethods.SpecialHut(TileID.GraniteBlock, TileID.Granite, WallID.GraniteUnsafe, 6, tilesX2, tilesY4); + } + if (Main.tile[tilesX, tilesY4].type == TileID.Marble && genMarbleHut) + { + genMarbleHut = false; + WorldGenerationMethods.SpecialHut(TileID.MarbleBlock, TileID.Marble, WallID.MarbleUnsafe, 7, tilesX, tilesY4); + } + if (Main.tile[tilesX2, tilesY4].type == TileID.Marble && genMarbleHut) + { + genMarbleHut = false; + WorldGenerationMethods.SpecialHut(TileID.MarbleBlock, TileID.Marble, WallID.MarbleUnsafe, 7, tilesX2, tilesY4); + } + if (genSwordHut) + { + genSwordHut = false; + WorldGenerationMethods.SpecialHut(TileID.HellstoneBrick, TileID.Hellstone, WallID.HellstoneBrick, 8, tilesX5, tilesY6); + } + } + })); + #endregion + + #region Abyss + tasks.Insert(FinalIndex + 3, new PassLegacy("Abyss", delegate (GenerationProgress progress) + { + progress.Message = "The Abyss"; + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; int rockLayer = (int)Main.rockLayer; - #region AbyssGen int abyssChasmY = y - 250; //Underworld = y - 200 abyssChasmBottom = abyssChasmY - 100; //850 small 1450 medium 2050 large int abyssChasmX = (abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); //2100 - 1965 = 135 : 2100 + 1965 = 4065 bool tenebrisSide = true; - if (abyssChasmX < genLimit) { tenebrisSide = false; } + if (abyssChasmX < genLimit) + { + tenebrisSide = false; + } + if (abyssSide) { for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 @@ -1037,68 +1196,77 @@ namespace CalamityMod } } } - ChasmGenerator(abyssChasmX, (int)WorldGen.worldSurfaceLow, abyssChasmBottom, true); - int maxAbyssIslands = 11; - if (y > 1500) { maxAbyssIslands = 16; if (y > 2100) { maxAbyssIslands = 20; } } - int islandLocationOffset = 30; - int islandLocationY = rockLayer; - if (CalamityWorld.genAbyssHut) //sometimes it works, sometimes it doesn't, wtf + + WorldGenerationMethods.ChasmGenerator(abyssChasmX, (int)WorldGen.worldSurfaceLow, abyssChasmBottom, true); + + int maxAbyssIslands = 11; //Small World + if (y > 2100) + maxAbyssIslands = 20; //Large World + else if (y > 1500) + maxAbyssIslands = 16; //Medium World + + if (genAbyssHut) //sometimes it works, sometimes it doesn't, wtf { - CalamityWorld.genAbyssHut = false; - SpecialHut((ushort)mod.TileType("SmoothVoidstone"), (ushort)mod.TileType("Voidstone"), + genAbyssHut = false; + WorldGenerationMethods.SpecialHut((ushort)mod.TileType("SmoothVoidstone"), (ushort)mod.TileType("Voidstone"), (ushort)mod.WallType("VoidstoneWallUnsafe"), 9, abyssChasmX, abyssChasmBottom); } + + int islandLocationOffset = 30; + int islandLocationY = rockLayer; for (int islands = 0; islands < maxAbyssIslands; islands++) { int islandLocationX = abyssChasmX; int randomIsland = WorldGen.genRand.Next(5); //0 1 2 3 4 bool hasVoidstone = islandLocationY > (rockLayer + y * 0.143); - CalamityWorld.AbyssIslandY[CalamityWorld.numAbyssIslands] = islandLocationY; + AbyssIslandY[numAbyssIslands] = islandLocationY; switch (randomIsland) { case 0: - AbyssIsland(islandLocationX, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX + 40, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX - 40, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX + 40, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX - 40, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); break; case 1: - AbyssIsland(islandLocationX + 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX - 40, islandLocationY + 10, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX + 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX - 40, islandLocationY + 10, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); islandLocationX += 30; break; case 2: - AbyssIsland(islandLocationX - 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX + 30, islandLocationY + 10, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX - 30, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX + 30, islandLocationY + 10, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); islandLocationX -= 30; break; case 3: - AbyssIsland(islandLocationX + 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX - 5, islandLocationY + 5, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX - 35, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX + 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX - 5, islandLocationY + 5, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX - 35, islandLocationY + 15, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); islandLocationX += 25; break; case 4: - AbyssIsland(islandLocationX - 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); - AbyssIsland(islandLocationX + 5, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); - AbyssIsland(islandLocationX + 35, islandLocationY + 5, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX - 25, islandLocationY, 60, 66, 30, 36, true, false, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX + 5, islandLocationY + 15, 60, 66, 30, 36, false, tenebrisSide, hasVoidstone); + WorldGenerationMethods.AbyssIsland(islandLocationX + 35, islandLocationY + 5, 60, 66, 30, 36, false, !tenebrisSide, hasVoidstone); islandLocationX -= 25; break; } - CalamityWorld.AbyssIslandX[CalamityWorld.numAbyssIslands] = islandLocationX; - CalamityWorld.numAbyssIslands++; + AbyssIslandX[numAbyssIslands] = islandLocationX; + numAbyssIslands++; islandLocationY += islandLocationOffset; } - CalamityWorld.AbyssItemArray = ShuffleArray(CalamityWorld.AbyssItemArray); - for (int abyssHouse = 0; abyssHouse < CalamityWorld.numAbyssIslands; abyssHouse++) //11 15 19 + + AbyssItemArray = WorldGenerationMethods.ShuffleArray(AbyssItemArray); + for (int abyssHouse = 0; abyssHouse < numAbyssIslands; abyssHouse++) //11 15 19 { if (abyssHouse != 20) - AbyssIslandHouse(CalamityWorld.AbyssIslandX[abyssHouse], - CalamityWorld.AbyssIslandY[abyssHouse], - CalamityWorld.AbyssItemArray[(abyssHouse > 9 ? (abyssHouse - 10) : abyssHouse)], //10 choices 0 to 9 - CalamityWorld.AbyssIslandY[abyssHouse] > (rockLayer + y * 0.143)); + WorldGenerationMethods.AbyssIslandHouse(AbyssIslandX[abyssHouse], + AbyssIslandY[abyssHouse], + AbyssItemArray[(abyssHouse > 9 ? (abyssHouse - 10) : abyssHouse)], //10 choices 0 to 9 + AbyssIslandY[abyssHouse] > (rockLayer + y * 0.143)); } + if (abyssSide) { for (int abyssIndex = 0; abyssIndex < abyssChasmX + 80; abyssIndex++) //235 @@ -1114,7 +1282,7 @@ namespace CalamityMod { int style = WorldGen.genRand.Next(13, 16); WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); - SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + WorldGenerationMethods.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); } } else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && @@ -1124,7 +1292,7 @@ namespace CalamityMod { int style = WorldGen.genRand.Next(25, 28); WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); - SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + WorldGenerationMethods.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); } } } @@ -1146,7 +1314,7 @@ namespace CalamityMod { int style = WorldGen.genRand.Next(13, 16); WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); - SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + WorldGenerationMethods.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); } } else if (WorldGen.SolidTile(abyssIndex, abyssIndex2 + 1) && @@ -1156,3382 +1324,22 @@ namespace CalamityMod { int style = WorldGen.genRand.Next(25, 28); WorldGen.PlacePot(abyssIndex, abyssIndex2, 28, style); - SafeSquareTileFrame(abyssIndex, abyssIndex2, true); + WorldGenerationMethods.SafeSquareTileFrame(abyssIndex, abyssIndex2, true); } } } } } } - #endregion - - #region Shrines - for (int k = 0; k < (int)((double)(x * y) * 50E-05); k++) - { - int tilesX = WorldGen.genRand.Next(0, generateBack); - int tilesX2 = WorldGen.genRand.Next(generateForward, x); - int tilesX3 = WorldGen.genRand.Next((int)((double)x * 0.3), generateBack); - int tilesX4 = WorldGen.genRand.Next(generateForward, (int)((double)x * 0.6)); - int tilesX5 = WorldGen.genRand.Next((int)((double)x * 0.97), (int)((double)x * 0.98)); - int tilesY3 = WorldGen.genRand.Next((int)(y * .3f), (int)(y * .35f)); - int tilesY4 = WorldGen.genRand.Next((int)(y * .35f), (int)(y * .5f)); - int tilesY5 = WorldGen.genRand.Next((int)(y * .55f), (int)(y * .8f)); - int tilesY6 = y - 60; - if ((Main.tile[tilesX3, tilesY3].type == TileID.Dirt || Main.tile[tilesX3, tilesY3].type == TileID.Stone) && CalamityWorld.genPureHut) - { - CalamityWorld.genPureHut = false; - SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX3, tilesY3); //red brick, dirt, red brick wall - } - if ((Main.tile[tilesX4, tilesY3].type == TileID.Dirt || Main.tile[tilesX4, tilesY3].type == TileID.Stone) && CalamityWorld.genPureHut) - { - CalamityWorld.genPureHut = false; - SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX4, tilesY3); - } - if (Main.tile[tilesX, tilesY3].type == (WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone) && CalamityWorld.genEvilHut) - { - CalamityWorld.genEvilHut = false; - SpecialHut(WorldGen.crimson ? TileID.CrimtaneBrick : TileID.DemoniteBrick, - WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone, - WorldGen.crimson ? WallID.CrimtaneBrick : WallID.DemoniteBrick, 1, tilesX, tilesY3); //crimstone brick, crimstone, crimstone brick wall - } - if (Main.tile[tilesX2, tilesY3].type == (WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone) && CalamityWorld.genEvilHut) - { - CalamityWorld.genEvilHut = false; - SpecialHut(WorldGen.crimson ? TileID.CrimtaneBrick : TileID.DemoniteBrick, - WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone, - WorldGen.crimson ? WallID.CrimtaneBrick : WallID.DemoniteBrick, 1, tilesX2, tilesY3); - } - if (Main.tile[tilesX3, tilesY5].type == TileID.Stone && CalamityWorld.genHellHut) - { - CalamityWorld.genHellHut = false; - SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, 2, tilesX3, tilesY5); //obsidian brick, obsidian, obsidian brick wall - } - if (Main.tile[tilesX4, tilesY5].type == TileID.Stone && CalamityWorld.genHellHut) - { - CalamityWorld.genHellHut = false; - SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, 2, tilesX4, tilesY5); - } - if (Main.tile[tilesX, tilesY4].type == TileID.IceBlock && CalamityWorld.genIceHut) - { - CalamityWorld.genIceHut = false; - SpecialHut(TileID.IceBrick, TileID.IceBlock, WallID.IceBrick, 3, tilesX, tilesY4); - } - if (Main.tile[tilesX2, tilesY4].type == TileID.IceBlock && CalamityWorld.genIceHut) - { - CalamityWorld.genIceHut = false; - SpecialHut(TileID.IceBrick, TileID.IceBlock, WallID.IceBrick, 3, tilesX2, tilesY4); - } - if (Main.tile[tilesX, tilesY4].type == TileID.DesertFossil && CalamityWorld.genSandHut) - { - CalamityWorld.genSandHut = false; - SpecialHut(TileID.DesertFossil, TileID.Sandstone, WallID.DesertFossil, 4, tilesX, tilesY4); - } - if (Main.tile[tilesX2, tilesY4].type == TileID.DesertFossil && CalamityWorld.genSandHut) - { - CalamityWorld.genSandHut = false; - SpecialHut(TileID.DesertFossil, TileID.Sandstone, WallID.DesertFossil, 4, tilesX2, tilesY4); - } - if (Main.tile[tilesX3, tilesY4].type == TileID.MushroomGrass && CalamityWorld.genMushroomHut) - { - CalamityWorld.genMushroomHut = false; - SpecialHut(TileID.MushroomBlock, TileID.Mud, WallID.MushroomUnsafe, 5, tilesX3, tilesY4); - } - if (Main.tile[tilesX4, tilesY4].type == TileID.MushroomGrass && CalamityWorld.genMushroomHut) - { - CalamityWorld.genMushroomHut = false; - SpecialHut(TileID.MushroomBlock, TileID.Mud, WallID.MushroomUnsafe, 5, tilesX4, tilesY4); - } - if (Main.tile[tilesX, tilesY4].type == TileID.Granite && CalamityWorld.genGraniteHut) - { - CalamityWorld.genGraniteHut = false; - SpecialHut(TileID.GraniteBlock, TileID.Granite, WallID.GraniteUnsafe, 6, tilesX, tilesY4); - } - if (Main.tile[tilesX2, tilesY4].type == TileID.Granite && CalamityWorld.genGraniteHut) - { - CalamityWorld.genGraniteHut = false; - SpecialHut(TileID.GraniteBlock, TileID.Granite, WallID.GraniteUnsafe, 6, tilesX2, tilesY4); - } - if (Main.tile[tilesX, tilesY4].type == TileID.Marble && CalamityWorld.genMarbleHut) - { - CalamityWorld.genMarbleHut = false; - SpecialHut(TileID.MarbleBlock, TileID.Marble, WallID.MarbleUnsafe, 7, tilesX, tilesY4); - } - if (Main.tile[tilesX2, tilesY4].type == TileID.Marble && CalamityWorld.genMarbleHut) - { - CalamityWorld.genMarbleHut = false; - SpecialHut(TileID.MarbleBlock, TileID.Marble, WallID.MarbleUnsafe, 7, tilesX2, tilesY4); - } - if (CalamityWorld.genSwordHut) - { - CalamityWorld.genSwordHut = false; - SpecialHut(TileID.HellstoneBrick, TileID.Hellstone, WallID.HellstoneBrick, 8, tilesX5, tilesY6); - } - } - #endregion - - #region Crag - int xUnderworldGen = WorldGen.genRand.Next((int)((double)x * 0.1), (int)((double)x * 0.15)); - int yUnderworldGen = y - 100; - CalamityWorld.fuhX = xUnderworldGen; - CalamityWorld.fuhY = yUnderworldGen; - UnderworldIsland(xUnderworldGen, yUnderworldGen, 180, 201, 120, 136); - UnderworldIsland(xUnderworldGen - 50, yUnderworldGen - 30, 100, 111, 60, 71); - UnderworldIsland(xUnderworldGen + 50, yUnderworldGen - 30, 100, 111, 60, 71); - ChasmGenerator(CalamityWorld.fuhX - 110, CalamityWorld.fuhY - 10, WorldGen.genRand.Next(150) + 150); - ChasmGenerator(CalamityWorld.fuhX + 110, CalamityWorld.fuhY - 10, WorldGen.genRand.Next(150) + 150); - UnderworldIsland(xUnderworldGen - 150, yUnderworldGen - 30, 60, 66, 35, 41); - UnderworldIsland(xUnderworldGen + 150, yUnderworldGen - 30, 60, 66, 35, 41); - UnderworldIsland(xUnderworldGen - 180, yUnderworldGen - 20, 60, 66, 35, 41); - UnderworldIsland(xUnderworldGen + 180, yUnderworldGen - 20, 60, 66, 35, 41); - UnderworldIslandHouse(CalamityWorld.fuhX, CalamityWorld.fuhY + 30, 1323); - UnderworldIslandHouse(CalamityWorld.fuhX - 22, CalamityWorld.fuhY + 15, 1322); - UnderworldIslandHouse(CalamityWorld.fuhX + 22, CalamityWorld.fuhY + 15, 535); - UnderworldIslandHouse(CalamityWorld.fuhX - 50, CalamityWorld.fuhY - 30, 112); - UnderworldIslandHouse(CalamityWorld.fuhX + 50, CalamityWorld.fuhY - 30, 906); - UnderworldIslandHouse(CalamityWorld.fuhX - 150, CalamityWorld.fuhY - 30, 218); - UnderworldIslandHouse(CalamityWorld.fuhX + 150, CalamityWorld.fuhY - 30, 3019); - UnderworldIslandHouse(CalamityWorld.fuhX - 180, CalamityWorld.fuhY - 20, 274); - UnderworldIslandHouse(CalamityWorld.fuhX + 180, CalamityWorld.fuhY - 20, 220); - #endregion - })); + #endregion } - tasks.Add(new PassLegacy("Planetoid Test", Planetoids)); + tasks.Add(new PassLegacy("Planetoid Test", WorldGenerationMethods.Planetoids)); } #endregion - #region BiomeChests - private void GenerateBiomeChests(GenerationProgress progress) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - // Get dungeon size field infos. These fields are private for some reason - int MinX = (int)typeof(WorldGen).GetField("dMinX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) + 25; - int MaxX = (int)typeof(WorldGen).GetField("dMaxX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; - int MaxY = (int)typeof(WorldGen).GetField("dMaxY", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; - int[] ChestTypes = new int[] { mod.TileType("AstralChestLocked") }; - int[] ItemTypes = new int[] { mod.ItemType("HeavenfallenStardisk") }; - - progress.Message = "Calamity Mod: Biome Chests"; - - int rounds = 1; - for (int i = 0; i < ChestTypes.Length * rounds; i++) - { - Chest chest = null; - int attempts = 0; - while (chest == null && attempts < 1000) - { - attempts++; - int x = WorldGen.genRand.Next(MinX, MaxX); - int y = WorldGen.genRand.Next((int)Main.worldSurface, MaxY); - if (Main.wallDungeon[Main.tile[x, y].wall] && !Main.tile[x, y].active()) - { - chest = AddChestWithDefaultLoot(x, y, (ushort)ChestTypes[i % ChestTypes.Length], 1, 2); - } - } - if (chest != null) - { - chest.item[0].SetDefaults(ItemTypes[i % ChestTypes.Length]); - chest.item[0].Prefix(-1); - } - } - } - - internal static Chest AddChestWithDefaultLoot(int i, int j, ushort type = TileID.Containers, uint emptySlots = 1, int Style = 0) - { - Chest chest = null; - while (j < Main.maxTilesY - 210) - { - if (!WorldGen.SolidTile(i, j)) - { - j++; - continue; - } - int chestIndex = WorldGen.PlaceChest(i - 1, j - 1, type, false, Style); - if (chestIndex < 0) - { - break; - } - chest = Main.chest[chestIndex]; - uint itemIndex = emptySlots; - while (itemIndex == emptySlots) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - bool AstralChest = type == mod.TileType("AstralChestLocked"); - int cItem; - cItem = WorldGen.genRand.NextBool() ? WorldGen.goldBar : WorldGen.silverBar; - int addAmount = 0; - if (AstralChest) - { - cItem = mod.ItemType("AstralBar"); - addAmount = 4; - } - chest.item[itemIndex].SetDefaults(cItem, false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(3 + addAmount, 11 + addAmount * 2); - itemIndex++; - if (WorldGen.genRand.NextBool()) - { - cItem = ItemID.HolyArrow; - int addAmount2 = 0; - if (AstralChest) - addAmount2 = 25; - chest.item[itemIndex].SetDefaults(cItem, false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(25 + addAmount2, 51 + addAmount2 * 2); - itemIndex++; - } - if (AstralChest) - { - chest.item[itemIndex].SetDefaults(mod.ItemType("AstralJelly"), false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(3, 6); - itemIndex++; - } - if (WorldGen.genRand.NextBool()) - { - int[] items = new int[] { - ItemID.SpelunkerPotion, ItemID.FeatherfallPotion, ItemID.NightOwlPotion, - ItemID.WaterWalkingPotion, ItemID.ArcheryPotion, ItemID.GravitationPotion - }; - if (AstralChest) - { - items[1] = mod.ItemType("RevivifyPotion"); - items[4] = ItemID.ShinePotion; - items[5] = ItemID.HunterPotion; - } - chest.item[itemIndex].SetDefaults(WorldGen.genRand.Next(items), false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3); - itemIndex++; - } - if (WorldGen.genRand.NextBool()) - { - int[] items = new int[] { - ItemID.ThornsPotion, ItemID.WaterWalkingPotion, ItemID.InvisibilityPotion, - ItemID.ManaRegenerationPotion, ItemID.TeleportationPotion, ItemID.TrapsightPotion, ItemID.TrapsightPotion // yes, dangersense potions have double the chance as other potions in vanilla for some reason - }; - if (AstralChest) - { - items[1] = ItemID.MagicPowerPotion; - items[2] = mod.ItemType("ZenPotion"); - items[5] = mod.ItemType("CadencePotion"); - } - chest.item[itemIndex].SetDefaults(WorldGen.genRand.Next(items), false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3); - itemIndex++; - } - if (WorldGen.genRand.NextBool()) - { - cItem = ItemID.RecallPotion; - int addAmount2 = 0; - if (AstralChest) - { - cItem = ItemID.BouncyDynamite; - addAmount2 = 2; - } - chest.item[itemIndex].SetDefaults(cItem, false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3) * addAmount2; - itemIndex++; - } - if (AstralChest) - addAmount = 2; - chest.item[itemIndex].SetDefaults(ItemID.GoldCoin, false); - chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3) * addAmount; - itemIndex++; - } - } - return chest; - } - #endregion - - #region SafeTileFrame - public static void SafeSquareTileFrame(int i, int j, bool resetFrame = true) - { - if (Main.tile[i, j] != null) - { - for (int x = i - 1; x <= i + 1; x++) - { - for (int y = j - 1; y <= j + 1; y++) - { - if (x < 0 || y < 0 || x >= Main.maxTilesX || y >= Main.maxTilesY) continue; - if (x == i && y == j) - { - WorldGen.TileFrame(i, j, resetFrame, false); - } - else - { - WorldGen.TileFrame(x, y, false, false); - } - } - } - } - } - #endregion - - #region ShuffleArray - public static int[] ShuffleArray(int[] array) - { - Random random = new Random(); - for (int index = array.Length; index > 0; index--) - { - int j = random.Next(index); - int k = array[j]; - array[j] = array[index - 1]; - array[index - 1] = k; - } - return array; - } - #endregion - - #region OreSpawn - public static void spawnOre(int type, double frequency, float depth, float depthLimit) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - bool genCenter = false; - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int generateBack = genLimit - 80; //Small = 2020 - int generateForward = genLimit + 80; //Small = 2180 - if (type == mod.TileType("ExodiumOre")) - { - genCenter = true; - depthLimit = 0.14f; - if (y > 1500) { depthLimit = 0.1f; if (y > 2100) { depthLimit = 0.07f; } } - } - if (Main.netMode != 1) - { - for (int k = 0; k < (int)((double)(x * y) * frequency); k++) - { - int tilesX = WorldGen.genRand.Next(0, (genCenter ? genLimit : generateBack)); - int tilesX2 = WorldGen.genRand.Next((genCenter ? genLimit : generateForward), x); - int tilesY = WorldGen.genRand.Next((int)(y * depth), (int)(y * depthLimit)); - if (type == mod.TileType("AuricOre")) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(12, 18), WorldGen.genRand.Next(12, 18), (ushort)type); - WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(12, 18), WorldGen.genRand.Next(12, 18), (ushort)type); - } - else if (type == mod.TileType("UelibloomOre")) - { - if (Main.tile[tilesX, tilesY].type == 59) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - if (Main.tile[tilesX2, tilesY].type == 59) - { - WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - else if (type == mod.TileType("PerennialOre")) - { - if (Main.tile[tilesX, tilesY].type == 0 || Main.tile[tilesX, tilesY].type == 1) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - if (Main.tile[tilesX2, tilesY].type == 0 || Main.tile[tilesX2, tilesY].type == 1) - { - WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - else if (type == mod.TileType("CryonicOre")) - { - if (Main.tile[tilesX, tilesY].type == 147 || Main.tile[tilesX, tilesY].type == 161 || Main.tile[tilesX, tilesY].type == 163 || Main.tile[tilesX, tilesY].type == 164 || Main.tile[tilesX, tilesY].type == 200) - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - if (Main.tile[tilesX2, tilesY].type == 147 || Main.tile[tilesX2, tilesY].type == 161 || Main.tile[tilesX2, tilesY].type == 163 || Main.tile[tilesX2, tilesY].type == 164 || Main.tile[tilesX2, tilesY].type == 200) - { - WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - else - { - WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - WorldGen.OreRunner(tilesX2, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); - } - } - } - } - #endregion - - #region AstralMeteor - public static bool checkAstralMeteor() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int num = 0; - float num2 = (float)(Main.maxTilesX / 4200); - int num3 = (int)(200f * num2); //Small = 201 Medium = 305 Large = 401 - for (int j = 5; j < Main.maxTilesX - 5; j++) - { - int num4 = 5; - while ((double)num4 < Main.worldSurface) - { - if (Main.tile[j, num4].active() && Main.tile[j, num4].type == mod.TileType("AstralOre")) - { - num++; - if (num > num3) - { - return false; - } - } - num4++; - } - } - return true; - } - - public static bool checkAstralBiomeSpawn() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int num = 0; - float num2 = (float)(Main.maxTilesX / 4200); - int num3 = (int)(400f * num2); //Small = 401 Medium = 605 Large = 801 - for (int j = 5; j < Main.maxTilesX - 5; j++) - { - int num4 = 5; - while ((double)num4 < Main.worldSurface) - { - if (Main.tile[j, num4].active() && - (Main.tile[j, num4].type == mod.TileType("AstralSand") || Main.tile[j, num4].type == mod.TileType("AstralSandstone") || - Main.tile[j, num4].type == mod.TileType("HardenedAstralSand") || Main.tile[j, num4].type == mod.TileType("AstralIce") || - Main.tile[j, num4].type == mod.TileType("AstralDirt") || Main.tile[j, num4].type == mod.TileType("AstralStone") || - Main.tile[j, num4].type == mod.TileType("AstralGrass"))) - { - num++; - if (num > num3) - { - return false; - } - } - num4++; - } - } - return true; - } - - public static void dropAstralMeteor() - { - Mod mod = ModLoader.GetMod("CalamityMod"); - bool flag = true; - if (Main.netMode == 1) - { - return; - } - for (int i = 0; i < 255; i++) - { - if (Main.player[i].active) - { - flag = false; - break; - } - } - if (!checkAstralMeteor()) - { - return; - } - float num5 = 600f; - while (!flag) - { - float num6 = (float)Main.maxTilesX * 0.08f; - int xLimit = Main.maxTilesX / 2; - int num7 = (abyssSide ? Main.rand.Next(250, xLimit) : Main.rand.Next(xLimit, Main.maxTilesX - 250)); - while ((float)num7 > (float)Main.spawnTileX - num6 && (float)num7 < (float)Main.spawnTileX + num6) - { - num7 = (abyssSide ? Main.rand.Next(250, xLimit) : Main.rand.Next(xLimit, Main.maxTilesX - 250)); - } - //world surface = 920 large 740 medium 560 small - int k = (int)(Main.worldSurface * 0.6); //Large = 522, Medium = 444, Small = 336 - while (k < Main.maxTilesY) - { - if (Main.tile[num7, k].active() && Main.tileSolid[(int)Main.tile[num7, k].type]) - { - int num8 = 0; - int num9 = 15; - for (int l = num7 - num9; l < num7 + num9; l++) - { - for (int m = k - num9; m < k + num9; m++) - { - if (WorldGen.SolidTile(l, m)) - { - num8++; - if (Main.tile[l, m].type == 189 || Main.tile[l, m].type == 202) - { - num8 -= 100; - } - } - else if (Main.tile[l, m].liquid > 0) - { - num8--; - } - } - } - if ((float)num8 < num5) - { - num5 -= 0.5f; - break; - } - flag = CalamityWorld.astralMeteor(num7, k); - if (flag) - { - break; - } - break; - } - else - { - k++; - } - } - if (num5 < 100f) - { - return; - } - } - } - - public static bool astralMeteor(int i, int j) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - if (i < 50 || i > Main.maxTilesX - 50) - { - return false; - } - if (j < 50 || j > Main.maxTilesY - 50) - { - return false; - } - int num = 35; - Rectangle rectangle = new Rectangle((i - num) * 16, (j - num) * 16, num * 2 * 16, num * 2 * 16); - for (int k = 0; k < 255; k++) - { - if (Main.player[k].active) - { - Rectangle value = new Rectangle((int)(Main.player[k].position.X + (float)(Main.player[k].width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(Main.player[k].position.Y + (float)(Main.player[k].height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2); - if (rectangle.Intersects(value)) - { - return false; - } - } - } - for (int l = 0; l < 200; l++) - { - if (Main.npc[l].active) - { - Rectangle value2 = new Rectangle((int)Main.npc[l].position.X, (int)Main.npc[l].position.Y, Main.npc[l].width, Main.npc[l].height); - if (rectangle.Intersects(value2)) - { - return false; - } - } - } - for (int m = i - num; m < i + num; m++) - { - for (int n = j - num; n < j + num; n++) - { - if (Main.tile[m, n].active() && Main.tile[m, n].type == 21) - { - return false; - } - } - } - num = WorldGen.genRand.Next(17, 23); - for (int num2 = i - num; num2 < i + num; num2++) - { - for (int num3 = j - num; num3 < j + num; num3++) - { - if (num3 > j + Main.rand.Next(-2, 3) - 5) - { - float num4 = (float)Math.Abs(i - num2); - float num5 = (float)Math.Abs(j - num3); - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - if ((double)num6 < (double)num * 0.9 + (double)Main.rand.Next(-4, 5)) - { - if (Main.tile[num2, num3] != null) - { - if (!Main.tileSolid[(int)Main.tile[num2, num3].type]) - { - Main.tile[num2, num3].active(false); - } - Main.tile[num2, num3].type = (ushort)mod.TileType("AstralOre"); - } - } - } - } - } - num = WorldGen.genRand.Next(8, 14); - for (int num7 = i - num; num7 < i + num; num7++) - { - for (int num8 = j - num; num8 < j + num; num8++) - { - if (num8 > j + Main.rand.Next(-2, 3) - 4) - { - float num9 = (float)Math.Abs(i - num7); - float num10 = (float)Math.Abs(j - num8); - float num11 = (float)Math.Sqrt((double)(num9 * num9 + num10 * num10)); - if ((double)num11 < (double)num * 0.8 + (double)Main.rand.Next(-3, 4)) - { - if (Main.tile[num7, num8] != null) - Main.tile[num7, num8].active(false); - } - } - } - } - num = WorldGen.genRand.Next(25, 35); - for (int num12 = i - num; num12 < i + num; num12++) - { - for (int num13 = j - num; num13 < j + num; num13++) - { - float num14 = (float)Math.Abs(i - num12); - float num15 = (float)Math.Abs(j - num13); - float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); - if (Main.tile[num12, num13] != null) - { - if ((double)num16 < (double)num * 0.7) - { - if (Main.tile[num12, num13].type == 5 || Main.tile[num12, num13].type == 32 || Main.tile[num12, num13].type == 352) - { - WorldGen.KillTile(num12, num13, false, false, false); - } - Main.tile[num12, num13].liquid = 0; - } - if (Main.tile[num12, num13].type == (ushort)mod.TileType("AstralOre")) - { - if (!WorldGen.SolidTile(num12 - 1, num13) && !WorldGen.SolidTile(num12 + 1, num13) && !WorldGen.SolidTile(num12, num13 - 1) && !WorldGen.SolidTile(num12, num13 + 1)) - { - Main.tile[num12, num13].active(false); - } - else if ((Main.tile[num12, num13].halfBrick() || Main.tile[num12 - 1, num13].topSlope()) && !WorldGen.SolidTile(num12, num13 + 1)) - { - Main.tile[num12, num13].active(false); - } - } - WorldGen.SquareTileFrame(num12, num13, true); - WorldGen.SquareWallFrame(num12, num13, true); - } - } - } - num = WorldGen.genRand.Next(23, 32); - for (int num17 = i - num; num17 < i + num; num17++) - { - for (int num18 = j - num; num18 < j + num; num18++) - { - if (num18 > j + WorldGen.genRand.Next(-3, 4) - 3 && Main.tile[num17, num18].active() && Main.rand.Next(10) == 0) - { - float num19 = (float)Math.Abs(i - num17); - float num20 = (float)Math.Abs(j - num18); - float num21 = (float)Math.Sqrt((double)(num19 * num19 + num20 * num20)); - if ((double)num21 < (double)num * 0.8) - { - if (Main.tile[num17, num18] != null) - { - if (Main.tile[num17, num18].type == 5 || Main.tile[num17, num18].type == 32 || Main.tile[num17, num18].type == 352) - { - WorldGen.KillTile(num17, num18, false, false, false); - } - Main.tile[num17, num18].type = (ushort)mod.TileType("AstralOre"); - WorldGen.SquareTileFrame(num17, num18, true); - } - } - } - } - } - num = WorldGen.genRand.Next(30, 38); - for (int num22 = i - num; num22 < i + num; num22++) - { - for (int num23 = j - num; num23 < j + num; num23++) - { - if (num23 > j + WorldGen.genRand.Next(-2, 3) && Main.tile[num22, num23].active() && Main.rand.Next(20) == 0) - { - float num24 = (float)Math.Abs(i - num22); - float num25 = (float)Math.Abs(j - num23); - float num26 = (float)Math.Sqrt((double)(num24 * num24 + num25 * num25)); - if ((double)num26 < (double)num * 0.85) - { - if (Main.tile[num22, num23] != null) - { - if (Main.tile[num22, num23].type == 5 || Main.tile[num22, num23].type == 32 || Main.tile[num22, num23].type == 352) - { - WorldGen.KillTile(num22, num23, false, false, false); - } - Main.tile[num22, num23].type = (ushort)mod.TileType("AstralOre"); - WorldGen.SquareTileFrame(num22, num23, true); - } - } - } - } - } - if (Main.netMode != 1) - { - NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None); - if (checkAstralBiomeSpawn()) - DoAstralConversion(new Point(i, j)); - } - return true; - } - - public static void DoAstralConversion(object obj) - { - //Pre-calculate all variables necessary for elliptical area checking - Point origin = (Point)obj; - Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - - float angle = MathHelper.Pi * 0.15f; - float otherAngle = MathHelper.PiOver2 - angle; - - int distanceInTiles = 150 + ((Main.maxTilesX - 4200) / 4200) * 200; - float distance = distanceInTiles * 16f; - float constant = (distance * 2f) / (float)Math.Sin(angle); - - float fociSpacing = ((distance * (float)Math.Sin(otherAngle)) / (float)Math.Sin(angle)); - int verticalRadius = (int)(constant / 16f); - - Vector2 fociOffset = Vector2.UnitY * fociSpacing; - Vector2 topFoci = center - fociOffset; - Vector2 bottomFoci = center + fociOffset; - - for (int x = origin.X - distanceInTiles - 2; x <= origin.X + distanceInTiles + 2; x++) - { - for (int y = (int)(origin.Y - verticalRadius * 0.4f) - 3; y <= origin.Y + verticalRadius + 3; y++) - { - float dist; - if (CheckInEllipse(new Point(x, y), topFoci, bottomFoci, constant, center, out dist, y < origin.Y)) - { - //If we're in the outer blurPercent% of the ellipse - float percent = dist / constant; - float blurPercent = 0.98f; - if (percent > blurPercent) - { - float outerEdgePercent = (percent - blurPercent) / (1f - blurPercent); - if (Main.rand.NextFloat(1f) > outerEdgePercent) - { - ConvertToAstral(x, y); - } - } - else - { - ConvertToAstral(x, y); - } - } - } - } - } - - public static void ConvertToAstral(int startX, int endX, int startY, int endY) - { - for (int x = startX; x <= endX; x++) - { - for (int y = startY; y <= endY; y++) - { - ConvertToAstral(x, y); - } - } - } - - public static void ConvertToAstral(int x, int y, bool tileframe = true) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - if (WorldGen.InWorld(x, y, 1)) - { - int type = Main.tile[x, y].type; - int wallType = Main.tile[x, y].wall; - - if (Main.tile[x, y] != null) - { - if (WallID.Sets.Conversion.Grass[wallType]) - { - Main.tile[x, y].wall = (ushort)mod.WallType("AstralGrassWallUnsafe"); - } - else if (WallID.Sets.Conversion.HardenedSand[wallType]) - { - Main.tile[x, y].wall = (ushort)mod.WallType("HardenedAstralSandWallUnsafe"); - } - else if (WallID.Sets.Conversion.Sandstone[wallType]) - { - Main.tile[x, y].wall = (ushort)mod.WallType("AstralSandstoneWallUnsafe"); - } - else if (WallID.Sets.Conversion.Stone[wallType]) - { - Main.tile[x, y].wall = (ushort)mod.WallType("AstralStoneWallUnsafe"); - } - else - { - switch (wallType) - { - case WallID.DirtUnsafe: - case WallID.DirtUnsafe1: - case WallID.DirtUnsafe2: - case WallID.DirtUnsafe3: - case WallID.DirtUnsafe4: - case WallID.Cave6Unsafe: - case WallID.Dirt: - Main.tile[x, y].wall = (ushort)mod.WallType("AstralDirtWallUnsafe"); - break; - case WallID.IceUnsafe: - Main.tile[x, y].wall = (ushort)mod.WallType("AstralIceWallUnsafe"); - break; - } - } - if (TileID.Sets.Conversion.Grass[type] && !TileID.Sets.GrassSpecial[type]) - { - Main.tile[x, y].type = (ushort)mod.TileType("AstralGrass"); - } - else if (TileID.Sets.Conversion.Stone[type] || Main.tileMoss[type]) - { - Main.tile[x, y].type = (ushort)mod.TileType("AstralStone"); - } - else if (TileID.Sets.Conversion.Sand[type]) - { - Main.tile[x, y].type = (ushort)mod.TileType("AstralSand"); - } - else if (TileID.Sets.Conversion.HardenedSand[type]) - { - Main.tile[x, y].type = (ushort)mod.TileType("HardenedAstralSand"); - } - else if (TileID.Sets.Conversion.Sandstone[type]) - { - Main.tile[x, y].type = (ushort)mod.TileType("AstralSandstone"); - } - else if (TileID.Sets.Conversion.Ice[type]) - { - Main.tile[x, y].type = (ushort)mod.TileType("AstralIce"); - } - else - { - Tile tile = Main.tile[x, y]; - switch (type) - { - case TileID.Dirt: - Main.tile[x, y].type = (ushort)mod.TileType("AstralDirt"); - break; - case TileID.Vines: - Main.tile[x, y].type = (ushort)mod.TileType("AstralVines"); - break; - case TileID.LargePiles: - if (tile.frameX <= 1170) - { - RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 0, 1170, 0, 18); - } - if (tile.frameX >= 1728) - { - RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 1728, 1872, 0, 18); - } - if (tile.frameX >= 1404 && tile.frameX <= 1710) - { - RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralIceLargePiles"), x, y, 324, 1404, 1710, 0, 18); - } - break; - case TileID.LargePiles2: - if (tile.frameX >= 1566 && tile.frameY < 36) - { - RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)mod.TileType("AstralDesertLargePiles"), x, y, 324, 1566, 1872, 0, 18); - } - if (tile.frameX >= 756 && tile.frameX <= 900) - { - RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 756, 900, 0, 18); - } - break; - case TileID.SmallPiles: - if (tile.frameY == 18) - { - ushort newType = 9999; - if (tile.frameX >= 1476 && tile.frameX <= 1674) - { - newType = (ushort)mod.TileType("AstralDesertMediumPiles"); - } - else if (tile.frameX <= 558 || (tile.frameX >= 1368 && tile.frameX <= 1458)) - { - newType = (ushort)mod.TileType("AstralNormalMediumPiles"); - } - else if (tile.frameX >= 900 && tile.frameX <= 1098) - { - newType = (ushort)mod.TileType("AstralIceMediumPiles"); - } - else - { - break; - } - int leftMost = x; - if (tile.frameX % 36 != 0) //this means it's the right tile of the two - { - leftMost--; - } - if (Main.tile[leftMost, y] != null) - Main.tile[leftMost, y].type = newType; - if (Main.tile[leftMost + 1, y] != null) - Main.tile[leftMost + 1, y].type = newType; - while (Main.tile[leftMost, y].frameX >= 216) - { - if (Main.tile[leftMost, y] != null) - Main.tile[leftMost, y].frameX -= 216; - if (Main.tile[leftMost + 1, y] != null) - Main.tile[leftMost + 1, y].frameX -= 216; - } - } - else if (tile.frameY == 0) - { - ushort newType3 = 9999; - if (tile.frameX >= 972 && tile.frameX <= 1062) - { - newType3 = (ushort)mod.TileType("AstralDesertSmallPiles"); - } - else if (tile.frameX <= 486) - { - newType3 = (ushort)mod.TileType("AstralNormalSmallPiles"); - } - else if (tile.frameX >= 648 && tile.frameX <= 846) - { - newType3 = (ushort)mod.TileType("AstralIceSmallPiles"); - } - else - { - break; - } - Main.tile[x, y].type = newType3; - while (Main.tile[x, y].frameX >= 108) //REFRAME IT - { - Main.tile[x, y].frameX -= 108; - } - } - break; - case TileID.Stalactite: - int topMost = tile.frameY <= 54 ? (tile.frameY % 36 == 0 ? y : y - 1) : y; - bool twoTall = tile.frameY <= 54; - bool hanging = tile.frameY <= 18 || tile.frameY == 72; - ushort newType2 = 9999; - if (tile.frameX >= 378 && tile.frameX <= 414) //DESERT - { - newType2 = (ushort)mod.TileType("AstralDesertStalactite"); - } - else if ((tile.frameX >= 54 && tile.frameX <= 90) || (tile.frameX >= 216 && tile.frameX <= 360)) - { - newType2 = (ushort)mod.TileType("AstralNormalStalactite"); - } - else if (tile.frameX <= 36) - { - newType2 = (ushort)mod.TileType("AstralIceStalactite"); - } - else - { - break; - } - - //Set types - if (Main.tile[x, topMost] != null) - Main.tile[x, topMost].type = newType2; - if (twoTall) - { - if (Main.tile[x, topMost + 1] != null) - Main.tile[x, topMost + 1].type = newType2; - } - - //Fix frames - while (Main.tile[x, topMost].frameX >= 54) - { - if (Main.tile[x, topMost] != null) - Main.tile[x, topMost].frameX -= 54; - if (twoTall) - { - if (Main.tile[x, topMost + 1] != null) - Main.tile[x, topMost + 1].frameX -= 54; - } - } - - if (hanging) - { - ConvertToAstral(x, topMost - 1); - break; - } - else - { - if (twoTall) - { - ConvertToAstral(x, topMost + 2); - break; - } - ConvertToAstral(x, topMost + 1); - break; - } - } - } - if (tileframe) - { - if (Main.netMode == 0) - { - WorldGen.SquareTileFrame(x, y, true); - } - else if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, x, y, 1); - } - } - } - } - } - - public static void ConvertFromAstral(int x, int y, ConvertType convert) - { - Tile tile = Main.tile[x, y]; - int type = tile.type; - int wallType = tile.wall; - Mod mod = CalamityMod.Instance; - - if (WorldGen.InWorld(x, y, 1)) - { - #region WALL - if (Main.tile[x, y] != null) - { - if (wallType == mod.WallType("AstralDirtWall")) - { - Main.tile[x, y].wall = WallID.DirtUnsafe; - } - else if (wallType == mod.WallType("AstralGrassWall")) - { - switch (convert) - { - case ConvertType.Corrupt: - Main.tile[x, y].wall = WallID.CorruptGrassUnsafe; - break; - case ConvertType.Crimson: - Main.tile[x, y].wall = WallID.CrimsonGrassUnsafe; - break; - case ConvertType.Hallow: - Main.tile[x, y].wall = WallID.HallowedGrassUnsafe; - break; - case ConvertType.Pure: - Main.tile[x, y].wall = WallID.GrassUnsafe; - break; - } - } - else if (wallType == mod.WallType("AstralIceWall")) - { - Main.tile[x, y].wall = WallID.IceUnsafe; - } - else if (wallType == mod.WallType("AstralStoneWall")) - { - switch (convert) - { - case ConvertType.Corrupt: - Main.tile[x, y].wall = WallID.EbonstoneUnsafe; - break; - case ConvertType.Crimson: - Main.tile[x, y].wall = WallID.CrimstoneUnsafe; - break; - case ConvertType.Hallow: - Main.tile[x, y].wall = WallID.PearlstoneBrickUnsafe; - break; - case ConvertType.Pure: - Main.tile[x, y].wall = WallID.Stone; - break; - } - } - } - #endregion - - #region TILE - if (Main.tile[x, y] != null) - { - if (type == mod.TileType("AstralDirt")) - { - tile.type = TileID.Dirt; - } - else if (type == mod.TileType("AstralGrass")) - { - SetTileFromConvert(x, y, convert, TileID.CorruptGrass, TileID.FleshGrass, TileID.HallowedGrass, TileID.Grass); - } - else if (type == mod.TileType("AstralStone")) - { - SetTileFromConvert(x, y, convert, TileID.Ebonstone, TileID.Crimstone, TileID.Pearlstone, TileID.Stone); - } - else if (type == mod.TileType("AstralSand")) - { - SetTileFromConvert(x, y, convert, TileID.Ebonsand, TileID.Crimsand, TileID.Pearlsand, TileID.Sand); - } - else if (type == mod.TileType("AstralSandstone")) - { - SetTileFromConvert(x, y, convert, TileID.CorruptSandstone, TileID.CrimsonSandstone, TileID.HallowSandstone, TileID.Sandstone); - } - else if (type == mod.TileType("HardenedAstralSand")) - { - SetTileFromConvert(x, y, convert, TileID.CorruptHardenedSand, TileID.CrimsonHardenedSand, TileID.HallowHardenedSand, TileID.HardenedSand); - } - else if (type == mod.TileType("AstralIce")) - { - SetTileFromConvert(x, y, convert, TileID.CorruptIce, TileID.FleshIce, TileID.HallowedIce, TileID.IceBlock); - } - else if (type == mod.TileType("AstralVines")) - { - SetTileFromConvert(x, y, convert, ushort.MaxValue, TileID.CrimsonVines, TileID.HallowedVines, TileID.Vines); - } - else if (type == mod.TileType("AstralShortPlants")) - { - SetTileFromConvert(x, y, convert, TileID.CorruptPlants, ushort.MaxValue, TileID.HallowedPlants, TileID.Plants); - } - else if (type == mod.TileType("AstralTallPlants")) - { - SetTileFromConvert(x, y, convert, ushort.MaxValue, ushort.MaxValue, TileID.HallowedPlants2, TileID.Plants2); - } - else if (type == mod.TileType("AstralNormalLargePiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 378, 0); - } - else if (type == mod.TileType("AstralNormalMediumPiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 18); - } - else if (type == mod.TileType("AstralNormalSmallPiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 0); - } - else if (type == mod.TileType("AstralDesertLargePiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles2, x, y, 1566, 0); - } - else if (type == mod.TileType("AstralDesertMediumPiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 1476, 18); - } - else if (type == mod.TileType("AstralDesertSmallPiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 972, 0); - } - else if (type == mod.TileType("AstralIceLargePiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 1404, 0); - } - else if (type == mod.TileType("AstralIceMediumPiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 900, 18); - } - else if (type == mod.TileType("AstralIceSmallPiles")) - { - RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 648, 0); - } - else if (type == mod.TileType("AstralNormalStalactite")) - { - ushort originType = TileID.Stone; - int frameXAdd = 54; - switch (convert) - { - case ConvertType.Corrupt: - originType = TileID.Ebonstone; - frameXAdd = 324; - break; - case ConvertType.Crimson: - originType = TileID.Crimstone; - frameXAdd = 270; - break; - case ConvertType.Hallow: - originType = TileID.Pearlstone; - frameXAdd = 216; - break; - } - ReplaceAstralStalactite((ushort)type, TileID.Stalactite, originType, x, y, frameXAdd, 0); - } - else if (type == mod.TileType("AstralDesertStalactite")) - { - ushort originType = TileID.Sandstone; - int frameXAdd = 378; - switch (convert) - { - case ConvertType.Corrupt: - originType = TileID.CorruptSandstone; - frameXAdd = 324; - break; - case ConvertType.Crimson: - originType = TileID.CrimsonSandstone; - frameXAdd = 270; - break; - case ConvertType.Hallow: - originType = TileID.HallowSandstone; - frameXAdd = 216; - break; - } - ReplaceAstralStalactite((ushort)type, TileID.Stalactite, originType, x, y, frameXAdd, 0); - } - else if (type == mod.TileType("AstralIceStalactite")) - { - ReplaceAstralStalactite((ushort)type, TileID.Stalactite, TileID.IceBlock, x, y, 0, 0); - } - if (TileID.Sets.Conversion.Grass[type] || type == TileID.Dirt) - { - WorldGen.SquareTileFrame(x, y); - } - } - #endregion - } - } - - private static void SetTileFromConvert(int x, int y, ConvertType convert, ushort corrupt, ushort crimson, ushort hallow, ushort pure) - { - switch (convert) - { - case ConvertType.Corrupt: - if (corrupt != ushort.MaxValue) - { - Main.tile[x, y].type = corrupt; - WorldGen.SquareTileFrame(x, y); - } - break; - case ConvertType.Crimson: - if (crimson != ushort.MaxValue) - { - Main.tile[x, y].type = crimson; - WorldGen.SquareTileFrame(x, y); - } - break; - case ConvertType.Hallow: - if (hallow != ushort.MaxValue) - { - Main.tile[x, y].type = hallow; - WorldGen.SquareTileFrame(x, y); - } - break; - case ConvertType.Pure: - if (pure != ushort.MaxValue) - { - Main.tile[x, y].type = pure; - WorldGen.SquareTileFrame(x, y); - } - break; - } - } - - private static void RecursiveReplaceToAstral(ushort checkType, ushort replaceType, int x, int y, int replaceTextureWidth, int minFrameX = 0, int maxFrameX = int.MaxValue, int minFrameY = 0, int maxFrameY = int.MaxValue) - { - Tile tile = Main.tile[x, y]; - if (tile == null || !tile.active() || tile.type != checkType || tile.frameX < minFrameX || tile.frameX > maxFrameX || tile.frameY < minFrameY || tile.frameY > maxFrameY) - return; - - Main.tile[x, y].type = replaceType; - while (Main.tile[x, y].frameX >= replaceTextureWidth) - { - Main.tile[x, y].frameX -= (short)replaceTextureWidth; - } - - if (Main.tile[x - 1, y] != null) - RecursiveReplaceToAstral(checkType, replaceType, x - 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); - if (Main.tile[x + 1, y] != null) - RecursiveReplaceToAstral(checkType, replaceType, x + 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); - if (Main.tile[x, y - 1] != null) - RecursiveReplaceToAstral(checkType, replaceType, x, y - 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); - if (Main.tile[x, y + 1] != null) - RecursiveReplaceToAstral(checkType, replaceType, x, y + 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); - } - - private static void RecursiveReplaceFromAstral(ushort checkType, ushort replaceType, int x, int y, int addFrameX, int addFrameY) - { - Tile tile = Main.tile[x, y]; - if (tile == null || !tile.active() || tile.type != checkType) - return; - - Main.tile[x, y].type = replaceType; - Main.tile[x, y].frameX += (short)addFrameX; - Main.tile[x, y].frameY += (short)addFrameY; - - if (Main.tile[x - 1, y] != null) - RecursiveReplaceFromAstral(checkType, replaceType, x - 1, y, addFrameX, addFrameY); - if (Main.tile[x + 1, y] != null) - RecursiveReplaceFromAstral(checkType, replaceType, x + 1, y, addFrameX, addFrameY); - if (Main.tile[x, y - 1] != null) - RecursiveReplaceFromAstral(checkType, replaceType, x, y - 1, addFrameX, addFrameY); - if (Main.tile[x, y + 1] != null) - RecursiveReplaceFromAstral(checkType, replaceType, x, y + 1, addFrameX, addFrameY); - } - - private static void ReplaceAstralStalactite(ushort checkType, ushort replaceType, ushort replaceOriginTile, int x, int y, int addFrameX, int addFrameY) - { - Tile tile = Main.tile[x, y]; - - int topMost = tile.frameY <= 54 ? (tile.frameY % 36 == 0 ? y : y - 1) : y; - bool twoTall = tile.frameY <= 54; - bool hanging = tile.frameY <= 18 || tile.frameY == 72; - - int yOriginTile = (hanging ? topMost - 1 : (twoTall ? topMost + 2 : y + 1)); - - if (Main.tile[x, topMost++] != null) - Main.tile[x, topMost++].type = replaceType; - if (twoTall) - { - if (Main.tile[x, topMost] != null) - Main.tile[x, topMost].type = replaceType; - } - if (Main.tile[x, yOriginTile] != null) - Main.tile[x, yOriginTile].type = replaceOriginTile; - } - - private static bool CheckInEllipse(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false) - { - Vector2 point = tile.ToVector2() * 16f + new Vector2(8f); - if (collapse) //Collapse ensures the ellipse is shrunk down a lot in terms of distance. - { - float distY = center.Y - point.Y; - point.Y -= distY * 8f; - } - float distance1 = Vector2.Distance(point, focus1); - float distance2 = Vector2.Distance(point, focus2); - distance = distance1 + distance2; - return distance <= distanceConstant; - } - #endregion - - #region EvilIsland - public static void EvilIsland(int i, int j) - { - double num = (double)WorldGen.genRand.Next(100, 150); //100 150 - float num2 = (float)WorldGen.genRand.Next(20, 30); //20 30 - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num12 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num12 < vector.Y) - { - num12 = vector.Y; - } - if (num12 > vector.Y + 2f) - { - num12 = vector.Y + 2f; - } - for (int l = num9; l < num10; l++) - { - if ((float)l > num12) - { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) - { - if (k < num3) - { - num3 = k; - } - if (k > num4) - { - num4 = k; - } - if (l < num5) - { - num5 = l; - } - if (l > num6) - { - num6 = l; - } - Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)(WorldGen.crimson ? 400 : 401); //ebonstone or crimstone - WorldGen.SquareTileFrame(k, l, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int m = num3; - int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) - { - int num14 = num6; - while (!Main.tile[m, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); - num15 = WorldGen.genRand.Next(4, 8); - int num16 = (WorldGen.crimson ? 400 : 401); - if (WorldGen.genRand.Next(4) == 0) - { - num16 = (WorldGen.crimson ? 398 : 399); - } - for (int n = m - num15; n <= m + num15; n++) - { - for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - m); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; - WorldGen.SquareTileFrame(n, num17, true); - } - } - } - } - } - num = (double)WorldGen.genRand.Next(80, 95); - num2 = (float)WorldGen.genRand.Next(10, 15); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = num5 - 1; - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; - float num19 = vector.Y + 1f; - for (int num20 = num7; num20 < num8; num20++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num19 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num19 < vector.Y) - { - num19 = vector.Y; - } - if (num19 > vector.Y + 2f) - { - num19 = vector.Y + 2f; - } - for (int num21 = num9; num21 < num10; num21++) - { - if ((float)num21 > num19) - { - float arg_69E_0 = Math.Abs((float)num20 - vector.X); - float num22 = Math.Abs((float)num21 - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_69E_0 * arg_69E_0 + num22 * num22)) < num11 * 0.4 && - Main.tile[num20, num21].type == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num20, num21].type = (ushort)(WorldGen.crimson ? 22 : 204); //ore - WorldGen.SquareTileFrame(num20, num21, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int num23 = num3; - num23 += WorldGen.genRand.Next(5); - while (num23 < num4) - { - int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) - { - num24--; - if (num24 < num5) - { - num24 = num6; - num23 += WorldGen.genRand.Next(1, 4); - } - } - if (num23 < num4) - { - num24 += WorldGen.genRand.Next(0, 4); - int num25 = WorldGen.genRand.Next(2, 5); - int num26 = (WorldGen.crimson ? 400 : 401); - for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) - { - for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) - { - if (num28 > num5) - { - float arg_890_0 = (float)Math.Abs(num27 - num23); - float num29 = (float)(Math.Abs(num28 - num24) * 2); - if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) - { - Main.tile[num27, num28].type = (ushort)num26; - WorldGen.SquareTileFrame(num27, num28, true); - } - } - } - } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); - } - } - for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) - { - for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) - { - bool flag = true; - for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) - { - for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) - { - if (!Main.tile[num32, num33].active()) - { - flag = false; - } - } - } - if (flag) - { - Main.tile[num30, num31].wall = (ushort)(WorldGen.crimson ? 220 : 221); - WorldGen.SquareWallFrame(num30, num31, true); - } - } - } - for (int num34 = num3; num34 <= num4; num34++) - { - int num35 = num5 - 10; - while (!Main.tile[num34, num35 + 1].active()) - { - num35++; - } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (WorldGen.crimson ? 400 : 401)) - { - if (WorldGen.genRand.Next(10) == 0) - { - int num36 = WorldGen.genRand.Next(1, 3); - for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) - { - if (Main.tile[num37, num35].type == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num37, num35].active(false); - Main.tile[num37, num35].liquid = 255; - Main.tile[num37, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - if (Main.tile[num37, num35 + 1].type == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num37, num35 + 1].active(false); - Main.tile[num37, num35 + 1].liquid = 255; - Main.tile[num37, num35 + 1].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 1, true); - } - if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (WorldGen.crimson ? 400 : 401)) - { - Main.tile[num37, num35 + 2].active(false); - Main.tile[num37, num35 + 2].liquid = 255; - Main.tile[num37, num35 + 2].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.Next(5) == 0) - { - Main.tile[num34, num35].liquid = 255; - } - Main.tile[num34, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - } - int num38 = WorldGen.genRand.Next(4); - for (int num39 = 0; num39 <= num38; num39++) - { - int num40 = WorldGen.genRand.Next(num3 - 5, num4 + 5); - int num41 = num5 - WorldGen.genRand.Next(20, 40); - int num42 = WorldGen.genRand.Next(4, 8); - int num43 = (WorldGen.crimson ? 400 : 401); - if (WorldGen.genRand.Next(2) == 0) - { - num43 = (WorldGen.crimson ? 398 : 399); - } - for (int num44 = num40 - num42; num44 <= num40 + num42; num44++) - { - for (int num45 = num41 - num42; num45 <= num41 + num42; num45++) - { - float arg_C74_0 = (float)Math.Abs(num44 - num40); - float num46 = (float)(Math.Abs(num45 - num41) * 2); - if (Math.Sqrt((double)(arg_C74_0 * arg_C74_0 + num46 * num46)) < (double)(num42 + WorldGen.genRand.Next(-1, 2))) - { - Main.tile[num44, num45].active(true); - Main.tile[num44, num45].type = (ushort)num43; - WorldGen.SquareTileFrame(num44, num45, true); - } - } - } - for (int num47 = num40 - num42 + 2; num47 <= num40 + num42 - 2; num47++) - { - int num48 = num41 - num42; - while (!Main.tile[num47, num48].active()) - { - num48++; - } - Main.tile[num47, num48].active(false); - Main.tile[num47, num48].liquid = 255; - WorldGen.SquareTileFrame(num47, num48, true); - } - } - } - #endregion - - #region EvilIslandHouse - public static void EvilIslandHouse(int i, int j) - { - ushort type = (ushort)(WorldGen.crimson ? 152 : 347); //tile - byte wall = (byte)(WorldGen.crimson ? 35 : 174); //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num = -1; - } - int num2 = WorldGen.genRand.Next(7, 12); - int num3 = WorldGen.genRand.Next(5, 7); - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].active()) - { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - if (m != num6 - 1 || (l != num4 && l != num5)) - { - Main.tile[l, m].active(true); - Main.tile[l, m].liquid = 0; - Main.tile[l, m].type = type; - Main.tile[l, m].wall = 0; - Main.tile[l, m].halfBrick(false); - Main.tile[l, m].slope(0); - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) - { - Main.tile[n, num8].active(false); - Main.tile[n, num8].wall = wall; - } - } - } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) - { - Main.tile[num11, num10].active(false); - Main.tile[num11, num10 - 1].active(false); - Main.tile[num11, num10 - 2].active(false); - } - WorldGen.PlaceTile(num9, num10, 10, true, false, -1, (WorldGen.crimson ? 1 : 10)); //door - num9 = i + (num2 + 1) * -num - num; - for (int num12 = num6; num12 <= num7 + 1; num12++) - { - Main.tile[num9, num12].active(true); - Main.tile[num9, num12].liquid = 0; - Main.tile[num9, num12].type = type; - Main.tile[num9, num12].wall = 0; - Main.tile[num9, num12].halfBrick(false); - Main.tile[num9, num12].slope(0); - } - int contain = 0; - if (WorldGen.crimson) - { - contain = 1571; //scourge - } - else - { - contain = 1569; //vampire - } - WorldGen.AddBuriedChest(i, num10 - 3, contain, false, (WorldGen.crimson ? 19 : 20)); //chest - int num14 = i - num2 / 2 + 1; - int num15 = i + num2 / 2 - 1; - int num16 = 1; - if (num2 > 10) - { - num16 = 2; - } - int num17 = (num6 + num7) / 2 - 1; - for (int num18 = num14 - num16; num18 <= num14 + num16; num18++) - { - for (int num19 = num17 - 1; num19 <= num17 + 1; num19++) - { - Main.tile[num18, num19].wall = 21; //glass - } - } - for (int num20 = num15 - num16; num20 <= num15 + num16; num20++) - { - for (int num21 = num17 - 1; num21 <= num17 + 1; num21++) - { - Main.tile[num20, num21].wall = 21; //glass - } - } - int num22 = i + (num2 / 2 + 1) * -num; - WorldGen.PlaceTile(num22, num7 - 1, 14, true, false, -1, (WorldGen.crimson ? 1 : 8)); //table - WorldGen.PlaceTile(num22 - 2, num7 - 1, 15, true, false, 0, (WorldGen.crimson ? 2 : 11)); //chair - Tile expr_510 = Main.tile[num22 - 2, num7 - 1]; - expr_510.frameX += 18; - Tile expr_531 = Main.tile[num22 - 2, num7 - 2]; - expr_531.frameX += 18; - WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, (WorldGen.crimson ? 2 : 11)); //chair - } - #endregion - - #region UnderworldIsland - public static void UnderworldIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 - float num2 = (float)WorldGen.genRand.Next(sizeMin / 5, sizeMax / 5); //20 30 - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num12 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num12 < vector.Y) - { - num12 = vector.Y; - } - if (num12 > vector.Y + 2f) - { - num12 = vector.Y + 2f; - } - for (int l = num9; l < num10; l++) - { - if ((float)l > num12) - { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) - { - if (k < num3) - { - num3 = k; - } - if (k > num4) - { - num4 = k; - } - if (l < num5) - { - num5 = l; - } - if (l > num6) - { - num6 = l; - } - Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)mod.TileType("BrimstoneSlag"); - WorldGen.SquareTileFrame(k, l, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int m = num3; - int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) - { - int num14 = num6; - while (!Main.tile[m, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); - num15 = WorldGen.genRand.Next(4, 8); - int num16 = mod.TileType("BrimstoneSlag"); - if (WorldGen.genRand.Next(4) == 0) - { - num16 = mod.TileType("CharredOre"); - } - for (int n = m - num15; n <= m + num15; n++) - { - for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - m); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; - WorldGen.SquareTileFrame(n, num17, true); - } - } - } - } - } - num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); - num2 = (float)WorldGen.genRand.Next(sizeMin2 / 8, sizeMax2 / 8); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int num23 = num3; - num23 += WorldGen.genRand.Next(5); - while (num23 < num4) - { - int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) - { - num24--; - if (num24 < num5) - { - num24 = num6; - num23 += WorldGen.genRand.Next(1, 4); - } - } - if (num23 < num4) - { - num24 += WorldGen.genRand.Next(0, 4); - int num25 = WorldGen.genRand.Next(2, 5); - int num26 = mod.TileType("BrimstoneSlag"); - for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) - { - for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) - { - if (num28 > num5) - { - float arg_890_0 = (float)Math.Abs(num27 - num23); - float num29 = (float)(Math.Abs(num28 - num24) * 2); - if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) - { - Main.tile[num27, num28].type = (ushort)num26; - WorldGen.SquareTileFrame(num27, num28, true); - } - } - } - } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); - } - } - for (int num34 = num3; num34 <= num4; num34++) - { - int num35 = num5 - 10; - while (!Main.tile[num34, num35 + 1].active()) - { - num35++; - } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)mod.TileType("BrimstoneSlag")) - { - if (WorldGen.genRand.Next(10) == 0) - { - int num36 = WorldGen.genRand.Next(1, 3); - for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) - { - if (Main.tile[num37, num35].type == (ushort)mod.TileType("BrimstoneSlag")) - { - Main.tile[num37, num35].active(false); - Main.tile[num37, num35].liquid = 255; - Main.tile[num37, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - if (Main.tile[num37, num35 + 1].type == (ushort)mod.TileType("BrimstoneSlag")) - { - Main.tile[num37, num35 + 1].active(false); - Main.tile[num37, num35 + 1].liquid = 255; - Main.tile[num37, num35 + 1].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 1, true); - } - if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)mod.TileType("BrimstoneSlag")) - { - Main.tile[num37, num35 + 2].active(false); - Main.tile[num37, num35 + 2].liquid = 255; - Main.tile[num37, num35 + 2].lava(false); - WorldGen.SquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.Next(5) == 0) - { - Main.tile[num34, num35].liquid = 255; - } - Main.tile[num34, num35].lava(false); - WorldGen.SquareTileFrame(num34, num35, true); - } - } - } - #endregion - - #region UnderworldIslandHouse - public static void UnderworldIslandHouse(int i, int j, int item) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - ushort type = (ushort)mod.TileType("BrimstoneSlag"); //tile - byte wall = (byte)14; //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num = -1; - } - int num2 = WorldGen.genRand.Next(7, 12); - int num3 = WorldGen.genRand.Next(5, 7); - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].active()) - { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - if (m != num6 - 1 || (l != num4 && l != num5)) - { - Main.tile[l, m].active(true); - Main.tile[l, m].liquid = 0; - Main.tile[l, m].type = type; - Main.tile[l, m].wall = 0; - Main.tile[l, m].halfBrick(false); - Main.tile[l, m].slope(0); - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) - { - Main.tile[n, num8].active(false); - Main.tile[n, num8].wall = wall; - } - } - } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) - { - Main.tile[num11, num10].active(false); - Main.tile[num11, num10 - 1].active(false); - Main.tile[num11, num10 - 2].active(false); - } - WorldGen.PlaceTile(num9, num10, 10, true, false, -1, 19); //door - num9 = i + (num2 + 1) * -num - num; - for (int num12 = num6; num12 <= num7 + 1; num12++) - { - Main.tile[num9, num12].active(true); - Main.tile[num9, num12].liquid = 0; - Main.tile[num9, num12].type = type; - Main.tile[num9, num12].wall = 0; - Main.tile[num9, num12].halfBrick(false); - Main.tile[num9, num12].slope(0); - } - WorldGen.AddBuriedChest(i, num10 - 3, item, false, 4); //chest - int num22 = i + (num2 / 2 + 1) * -num; - WorldGen.PlaceTile(num22, num7 - 1, 14, true, false, -1, 13); //table - WorldGen.PlaceTile(num22 - 2, num7 - 1, 15, true, false, 0, 16); //chair - Tile expr_510 = Main.tile[num22 - 2, num7 - 1]; - expr_510.frameX += 18; - Tile expr_531 = Main.tile[num22 - 2, num7 - 2]; - expr_531.frameX += 18; - WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, 16); //chair - } - #endregion - - #region AbyssIsland - public static void AbyssIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2, bool hasChest, bool hasTenebris, bool isVoid) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int sizeMinSmall = sizeMin / 5; - int sizeMaxSmall = sizeMax / 5; - double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 - float num2 = (float)WorldGen.genRand.Next(sizeMinSmall, sizeMaxSmall); //20 30 - int num3 = i; - int num4 = i; - int num5 = i; - int num6 = j; - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - int num7 = (int)((double)vector.X - num * 0.5); - int num8 = (int)((double)vector.X + num * 0.5); - int num9 = (int)((double)vector.Y - num * 0.5); - int num10 = (int)((double)vector.Y + num * 0.5); - if (num7 < 0) - { - num7 = 0; - } - if (num8 > Main.maxTilesX) - { - num8 = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (num10 > Main.maxTilesY) - { - num10 = Main.maxTilesY; - } - double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 - float num12 = vector.Y + 1f; - for (int k = num7; k < num8; k++) - { - if (WorldGen.genRand.Next(2) == 0) - { - num12 += (float)WorldGen.genRand.Next(-1, 2); - } - if (num12 < vector.Y) - { - num12 = vector.Y; - } - if (num12 > vector.Y + 2f) - { - num12 = vector.Y + 2f; - } - for (int l = num9; l < num10; l++) - { - if ((float)l > num12) - { - float arg_218_0 = Math.Abs((float)k - vector.X); - float num13 = Math.Abs((float)l - vector.Y) * 3f; - if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) - { - if (k < num3) - { - num3 = k; - } - if (k > num4) - { - num4 = k; - } - if (l < num5) - { - num5 = l; - } - if (l > num6) - { - num6 = l; - } - Main.tile[k, l].active(true); - Main.tile[k, l].type = (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); - SafeSquareTileFrame(k, l, true); - } - } - } - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int m = num3; - int num15; - for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) - { - int num14 = num6; - while (!Main.tile[m, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); - num15 = WorldGen.genRand.Next(4, 8); - int num16 = (isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); - if (WorldGen.genRand.Next(4) == 0) - { - num16 = (hasChest ? mod.TileType("ChaoticOre") : mod.TileType("PlantyMush")); - } - for (int n = m - num15; n <= m + num15; n++) - { - for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - m); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; - SafeSquareTileFrame(n, num17, true); - } - } - } - } - } - if (hasTenebris) - { - int p = num3; - int num150; - for (p += WorldGen.genRand.Next(5); p < num4; p += WorldGen.genRand.Next(num150, (int)((double)num150 * 1.5))) - { - int num14 = num6; - while (!Main.tile[p, num14].active()) - { - num14--; - } - num14 += WorldGen.genRand.Next(-3, 4); //-3 4 - num150 = 1; //4 8 - int num16 = mod.TileType("Tenebris"); - for (int n = p - num150; n <= p + num150; n++) - { - for (int num17 = num14 - num150; num17 <= num14 + num150; num17++) - { - if (num17 > num5) - { - float arg_409_0 = (float)Math.Abs(n - p); - float num18 = (float)(Math.Abs(num17 - num14) * 2); - if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num150 + WorldGen.genRand.Next(2))) - { - Main.tile[n, num17].active(true); - Main.tile[n, num17].type = (ushort)num16; - SafeSquareTileFrame(n, num17, true); - } - } - } - } - } - } - int sizeMinSmall2 = sizeMin2 / 8; - int sizeMaxSmall2 = sizeMax2 / 8; - num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); - num2 = (float)WorldGen.genRand.Next(sizeMinSmall2, sizeMaxSmall2); - vector.X = (float)i; - vector.Y = (float)num5; - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - while (vector2.X > -2f && vector2.X < 2f) - { - vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; - } - vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; - while (num > 0.0 && num2 > 0f) - { - num -= (double)WorldGen.genRand.Next(4); - num2 -= 1f; - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if ((double)vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if ((double)vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - int num23 = num3; - num23 += WorldGen.genRand.Next(5); - while (num23 < num4) - { - int num24 = num6; - while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) - { - num24--; - if (num24 < num5) - { - num24 = num6; - num23 += WorldGen.genRand.Next(1, 4); - } - } - if (num23 < num4) - { - num24 += WorldGen.genRand.Next(0, 4); - int num25 = WorldGen.genRand.Next(2, 5); - int num26 = (isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); - for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) - { - for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) - { - if (num28 > num5) - { - float arg_890_0 = (float)Math.Abs(num27 - num23); - float num29 = (float)(Math.Abs(num28 - num24) * 2); - if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) - { - Main.tile[num27, num28].type = (ushort)num26; - SafeSquareTileFrame(num27, num28, true); - } - } - } - } - num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); - } - } - for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) - { - for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) - { - bool flag = true; - for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) - { - for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) - { - if (!Main.tile[num32, num33].active()) - { - flag = false; - } - } - } - if (flag) - { - Main.tile[num30, num31].wall = (ushort)(isVoid ? mod.WallType("VoidstoneWallUnsafe") : mod.WallType("AbyssGravelWall")); - WorldGen.SquareWallFrame(num30, num31, true); - } - } - } - for (int num34 = num3; num34 <= num4; num34++) - { - int num35 = num5 - 10; - while (!Main.tile[num34, num35 + 1].active()) - { - num35++; - } - if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) - { - if (WorldGen.genRand.Next(10) == 0) - { - int num36 = WorldGen.genRand.Next(1, 3); - for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) - { - if (Main.tile[num37, num35].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) - { - Main.tile[num37, num35].active(false); - Main.tile[num37, num35].liquid = 255; - Main.tile[num37, num35].lava(false); - SafeSquareTileFrame(num34, num35, true); - } - if (Main.tile[num37, num35 + 1].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) - { - Main.tile[num37, num35 + 1].active(false); - Main.tile[num37, num35 + 1].liquid = 255; - Main.tile[num37, num35 + 1].lava(false); - SafeSquareTileFrame(num34, num35 + 1, true); - } - if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) - { - Main.tile[num37, num35 + 2].active(false); - Main.tile[num37, num35 + 2].liquid = 255; - Main.tile[num37, num35 + 2].lava(false); - SafeSquareTileFrame(num34, num35 + 2, true); - } - } - } - if (WorldGen.genRand.Next(5) == 0) - { - Main.tile[num34, num35].liquid = 255; - } - Main.tile[num34, num35].lava(false); - SafeSquareTileFrame(num34, num35, true); - } - } - } - #endregion - - #region AbyssIslandHouse - public static void AbyssIslandHouse(int i, int j, int itemChoice, bool isVoid) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - ushort type = (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); //tile - ushort wall = (ushort)(isVoid ? mod.WallType("VoidstoneWallUnsafe") : mod.WallType("AbyssGravelWall")); //wall - Vector2 vector = new Vector2((float)i, (float)j); - int num = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num = -1; - } - int num2 = WorldGen.genRand.Next(5, 9); - int num3 = 3; - vector.X = (float)(i + (num2 + 2) * num); - for (int k = j - 15; k < j + 30; k++) - { - if (Main.tile[(int)vector.X, k].active()) - { - vector.Y = (float)(k - 1); - break; - } - } - vector.X = (float)i; - int num4 = (int)(vector.X - (float)num2 - 1f); - int num5 = (int)(vector.X + (float)num2 + 1f); - int num6 = (int)(vector.Y - (float)num3 - 1f); - int num7 = (int)(vector.Y + 2f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int l = num4; l <= num5; l++) - { - for (int m = num6 - 1; m < num7 + 1; m++) - { - if (m != num6 - 1 || (l != num4 && l != num5)) - { - Main.tile[l, m].active(true); - Main.tile[l, m].type = type; - Main.tile[l, m].wall = wall; - Main.tile[l, m].halfBrick(false); - Main.tile[l, m].slope(0); - } - } - } - num4 = (int)(vector.X - (float)num2); - num5 = (int)(vector.X + (float)num2); - num6 = (int)(vector.Y - (float)num3); - num7 = (int)(vector.Y + 1f); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX) - { - num5 = Main.maxTilesX; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int n = num4; n <= num5; n++) - { - for (int num8 = num6; num8 < num7; num8++) - { - if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == wall) - { - Main.tile[n, num8].active(false); - } - } - } - int num9 = i + (num2 + 1) * num; - int num10 = (int)vector.Y; - for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) - { - Main.tile[num11, num10].active(false); - Main.tile[num11, num10 - 1].active(false); - Main.tile[num11, num10 - 2].active(false); - } - switch (itemChoice) - { - case 0: itemChoice = mod.ItemType("TorrentialTear"); break; //rain item - case 1: itemChoice = mod.ItemType("IronBoots"); break; //movement acc - case 2: itemChoice = mod.ItemType("DepthCharm"); break; //regen acc - case 3: itemChoice = mod.ItemType("Archerfish"); break; //ranged - case 4: itemChoice = mod.ItemType("AnechoicPlating"); break; //defense acc - case 5: itemChoice = mod.ItemType("BallOFugu"); break; //melee - case 6: itemChoice = mod.ItemType("StrangeOrb"); break; //light pet - case 7: itemChoice = mod.ItemType("HerringStaff"); break; //summon - case 8: itemChoice = mod.ItemType("BlackAnurian"); break; //magic - case 9: itemChoice = mod.ItemType("Lionfish"); break; //throwing - default: itemChoice = 497; break; - } - WorldGen.AddBuriedChest(i, num10 - 3, itemChoice, false, 4); //chest - } - #endregion - - #region IcePyramid - public static bool IcePyramid(int i, int j) - { - ushort num = 161; - int arg_36_0 = j - WorldGen.genRand.Next(0, 7); - int num2 = WorldGen.genRand.Next(9, 13); - int num3 = 1; - int num4 = j + WorldGen.genRand.Next(75, 125); //75 125 - for (int k = arg_36_0; k < num4; k++) - { - for (int l = i - num3; l < i + num3 - 1; l++) - { - Main.tile[l, k].type = num; - Main.tile[l, k].active(true); - Main.tile[l, k].halfBrick(false); - Main.tile[l, k].slope(0); - } - num3++; - } - for (int m = i - num3 - 5; m <= i + num3 + 5; m++) - { - for (int n = j - 1; n <= num4 + 1; n++) - { - bool flag = true; - for (int num5 = m - 1; num5 <= m + 1; num5++) - { - for (int num6 = n - 1; num6 <= n + 1; num6++) - { - if (Main.tile[num5, num6].type != num) - { - flag = false; - } - } - } - if (flag) - { - Main.tile[m, n].wall = 71; - WorldGen.SquareWallFrame(m, n, true); - } - } - } - int num7 = 1; - if (WorldGen.genRand.Next(2) == 0) - { - num7 = -1; - } - int num8 = i - num2 * num7; - int num9 = j + num2; - int num10 = WorldGen.genRand.Next(5, 8); - bool flag2 = true; - int num11 = WorldGen.genRand.Next(20, 30); - while (flag2) - { - flag2 = false; - bool flag3 = false; - for (int num12 = num9; num12 <= num9 + num10; num12++) - { - int num13 = num8; - if (Main.tile[num13, num12 - 1].type == 161) - { - flag3 = true; - } - if (Main.tile[num13, num12].type == num) - { - Main.tile[num13, num12 + 1].wall = 71; - Main.tile[num13 + num7, num12].wall = 71; - Main.tile[num13, num12].active(false); - flag2 = true; - } - if (flag3) - { - Main.tile[num13, num12].type = 161; - Main.tile[num13, num12].active(true); - Main.tile[num13, num12].halfBrick(false); - Main.tile[num13, num12].slope(0); - } - } - num8 -= num7; - } - num8 = i - num2 * num7; - bool flag4 = true; - bool flag5 = false; - flag2 = true; - while (flag2) - { - for (int num14 = num9; num14 <= num9 + num10; num14++) - { - int num15 = num8; - Main.tile[num15, num14].active(false); - } - num8 += num7; - num9++; - num11--; - if (num9 >= num4 - num10 * 2) - { - num11 = 10; - } - if (num11 <= 0) - { - bool flag6 = false; - if (!flag4 && !flag5) - { - flag5 = true; - flag6 = true; - int num16 = WorldGen.genRand.Next(7, 13); - int num17 = WorldGen.genRand.Next(23, 28); - int num18 = num17; - int num19 = num8; - while (num17 > 0) - { - for (int num20 = num9 - num16 + num10; num20 <= num9 + num10; num20++) - { - if (num17 == num18 || num17 == 1) - { - if (num20 >= num9 - num16 + num10 + 2) - { - Main.tile[num8, num20].active(false); - } - } - else if (num17 == num18 - 1 || num17 == 2 || num17 == num18 - 2 || num17 == 3) - { - if (num20 >= num9 - num16 + num10 + 1) - { - Main.tile[num8, num20].active(false); - } - } - else - { - Main.tile[num8, num20].active(false); - } - } - num17--; - num8 += num7; - } - int num21 = num8 - num7; - int num22 = num21; - int num23 = num19; - if (num21 > num19) - { - num22 = num19; - num23 = num21; - } - int num24 = WorldGen.genRand.Next(3); - if (num24 == 0) - { - num24 = 1861; //diving gear - } - else if (num24 == 1) - { - num24 = 1163; //balloon - } - else if (num24 == 2) - { - num24 = 1253; //shell - } - WorldGen.AddBuriedChest((num22 + num23) / 2, num9, num24, false, 22); - int num25 = WorldGen.genRand.Next(1, 10); - for (int num26 = 0; num26 < num25; num26++) - { - int arg_49B_0 = WorldGen.genRand.Next(num22, num23); - int j2 = num9 + num10; - WorldGen.PlaceSmallPile(arg_49B_0, j2, WorldGen.genRand.Next(16, 19), 1, 185); - } - for (int num27 = num22; num27 <= num23; num27++) - { - WorldGen.PlacePot(num27, num9 + num10, 28, WorldGen.genRand.Next(4, 7)); - } - } - if (flag4) - { - flag4 = false; - num7 *= -1; - num11 = WorldGen.genRand.Next(15, 20); - } - else if (flag6) - { - num11 = WorldGen.genRand.Next(10, 15); - } - else - { - num7 *= -1; - num11 = WorldGen.genRand.Next(20, 40); - } - } - if (num9 >= num4 - num10) - { - flag2 = false; - } - } - int num28 = WorldGen.genRand.Next(20, 40); //100 200 - int num29 = WorldGen.genRand.Next(100, 160); //500 800 - flag2 = true; - int num30 = num10; - num11 = WorldGen.genRand.Next(10, 50); - if (num7 == 1) - { - num8 -= num30; - } - int num31 = WorldGen.genRand.Next(5, 10); - while (flag2) - { - num28--; - num29--; - num11--; - for (int num32 = num8 - num31 - WorldGen.genRand.Next(0, 2); num32 <= num8 + num30 + num31 + WorldGen.genRand.Next(0, 2); num32++) - { - int num33 = num9; - if (num32 >= num8 && num32 <= num8 + num30) - { - Main.tile[num32, num33].active(false); - } - else - { - Main.tile[num32, num33].type = num; - Main.tile[num32, num33].active(true); - Main.tile[num32, num33].halfBrick(false); - Main.tile[num32, num33].slope(0); - } - if (num32 >= num8 - 1 && num32 <= num8 + 1 + num30) - { - Main.tile[num32, num33].wall = 71; - } - } - num9++; - num8 += num7; - if (num28 <= 0) - { - flag2 = false; - for (int num34 = num8 + 1; num34 <= num8 + num30 - 1; num34++) - { - if (Main.tile[num34, num9].active()) - { - flag2 = true; - } - } - } - if (num11 < 0) - { - num11 = WorldGen.genRand.Next(10, 50); - num7 *= -1; - } - if (num29 <= 0) - { - flag2 = false; - } - } - return true; - } - #endregion - - #region SpecialHut - public static void SpecialHut(ushort tile, ushort tile2, ushort wall, int hutType, int chestX, int chestY) - { - int m = WorldGen.genRand.Next(2, 4); - int num6 = WorldGen.genRand.Next(2, 4); - for (int n = chestX - m - 1; n <= chestX + m + 1; n++) - { - for (int num8 = chestY - num6 - 1; num8 <= chestY + num6 + 1; num8++) - { - Main.tile[n, num8].active(true); - Main.tile[n, num8].type = tile; - Main.tile[n, num8].liquid = 0; - Main.tile[n, num8].lava(false); - } - } - for (int num9 = chestX - m; num9 <= chestX + m; num9++) - { - for (int num10 = chestY - num6; num10 <= chestY + num6; num10++) - { - Main.tile[num9, num10].active(false); - Main.tile[num9, num10].wall = wall; - } - } - for (int num14 = chestX - m - 1; num14 <= chestX + m + 1; num14++) - { - for (int num15 = chestY + num6 - 2; num15 <= chestY + num6; num15++) - { - Main.tile[num14, num15].active(false); - } - } - for (int num16 = chestX - m - 1; num16 <= chestX + m + 1; num16++) - { - for (int num17 = chestY + num6 - 2; num17 <= chestY + num6 - 1; num17++) - { - Main.tile[num16, num17].active(false); - } - } - for (int num18 = chestX - m - 1; num18 <= chestX + m + 1; num18++) - { - int num19 = 4; - int num20 = chestY + num6 + 2; - while (!Main.tile[num18, num20].active() && num20 < Main.maxTilesY && num19 > 0) - { - Main.tile[num18, num20].active(true); - Main.tile[num18, num20].type = tile2; - num20++; - num19--; - } - } - m -= WorldGen.genRand.Next(1, 3); - int num21 = chestY - num6 - 2; - while (m > -1) - { - for (int num22 = chestX - m - 1; num22 <= chestX + m + 1; num22++) - { - Main.tile[num22, num21].active(true); - Main.tile[num22, num21].type = tile; - } - m -= WorldGen.genRand.Next(1, 3); - num21--; - } - CalamityWorld.SChestX[hutType] = chestX; - CalamityWorld.SChestY[hutType] = chestY; - SpecialChest(hutType); - } - #endregion - - #region SpecialChest - public static void SpecialChest(int itemChoice) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - int item = 0; - int chestType = 0; - switch (itemChoice) //0 to 9 - { - case 0: item = ItemID.TigerClimbingGear; break; - case 1: item = (WorldGen.crimson ? ItemID.FleshKnuckles : ItemID.PutridScent); chestType = (WorldGen.crimson ? 43 : 3); break; - case 2: item = ItemID.LavaWaders; chestType = 44; break; - case 3: item = ItemID.MagicCuffs; chestType = 47; break; - case 4: item = ItemID.SunStone; chestType = 30; break; - case 5: item = ItemID.PapyrusScarab; chestType = 32; break; - case 6: item = ItemID.StarCloak; chestType = 50; break; - case 7: item = ItemID.CrossNecklace; chestType = 51; break; - case 8: item = mod.ItemType("Murasama"); chestType = 44; break; - case 9: item = mod.ItemType("BossRush"); chestType = 4; break; - } - for (int j = CalamityWorld.SChestX[itemChoice] - 1; j <= CalamityWorld.SChestX[itemChoice] + 1; j++) - { - for (int k = CalamityWorld.SChestY[itemChoice]; k <= CalamityWorld.SChestY[itemChoice] + 2; k++) - { - WorldGen.KillTile(j, k, false, false, false); - } - } - for (int l = CalamityWorld.SChestX[itemChoice] - 1; l <= CalamityWorld.SChestX[itemChoice] + 1; l++) - { - for (int m = CalamityWorld.SChestY[itemChoice]; m <= CalamityWorld.SChestY[itemChoice] + 3; m++) - { - if (m < Main.maxTilesY) - { - Main.tile[l, m].slope(0); - Main.tile[l, m].halfBrick(false); - } - } - } - WorldGen.AddBuriedChest(CalamityWorld.SChestX[itemChoice], CalamityWorld.SChestY[itemChoice], item, false, chestType); - } - #endregion - - #region ChasmGenerator - public static void ChasmGenerator(int i, int j, int steps, bool ocean = false) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - float num = (float)steps; //850 small 1450 medium 2050 large - if (ocean) - { - int tileYLookup = j; - if (abyssSide) - { - while (!Main.tile[i + 125, tileYLookup].active()) - { - tileYLookup++; - } - } - else - { - while (!Main.tile[i - 125, tileYLookup].active()) - { - tileYLookup++; - } - } - j = tileYLookup; - } - Vector2 vector; - vector.X = (float)i; - vector.Y = (float)j; - Vector2 vector2; - vector2.X = (float)WorldGen.genRand.Next(-1, 2) * 0.1f; - vector2.Y = (float)WorldGen.genRand.Next(3, 8) * 0.2f + 0.5f; - int num2 = 5; - double num3 = (double)(WorldGen.genRand.Next(5, 7) + 40); //start width - while (num3 > 0.0) - { - if (num > 0f) - { - num3 += (double)WorldGen.genRand.Next(2); - num3 -= (double)WorldGen.genRand.Next(2); - float smallHoleLimit = 790f; //small - if (Main.maxTilesY > 1500) { smallHoleLimit = 1360f; if (Main.maxTilesY > 2100) { smallHoleLimit = 1950f; } } - if (ocean && num > smallHoleLimit) - { - if (num3 < 4.0) //min width - { - num3 = 4.0; //min width - } - if (num3 > 6.0) //max width - { - num3 = 6.0; //max width - } - } - else //dig large hole - { - if (num3 < (ocean ? 42.0 : 14.0)) //min width - { - num3 = (ocean ? 42.0 : 14.0); //min width - } - if (num3 > (ocean ? 60.0 : 40.0)) //max width - { - num3 = (ocean ? 60.0 : 40.0); //max width - } - if (num == 1f && num3 < (ocean ? 50.0 : 20.0)) - { - num3 = (ocean ? 50.0 : 20.0); - } - } - } - else - { - if ((double)vector.Y > abyssChasmBottom) - { - num3 -= (double)(WorldGen.genRand.Next(5) + 8); - } - } - if (Main.maxTilesY > 2100) - { - if (((double)vector.Y > abyssChasmBottom && num > 0f && ocean) || - ((double)vector.Y >= (double)Main.maxTilesY && num > 0f && !ocean)) - { - num = 0f; - } - } - else if (Main.maxTilesY > 1500) - { - if (((double)vector.Y > abyssChasmBottom && num > 0f && ocean) || - ((double)vector.Y > (double)Main.maxTilesY && num > 0f && !ocean)) - { - num = 0f; - } - } - else - { - if (((double)vector.Y > abyssChasmBottom && num > 0f && ocean) || - ((double)vector.Y > (double)Main.maxTilesY && num > 0f && !ocean)) - { - num = 0f; - } - } - num -= 1f; - int num4; - int num5; - int num6; - int num7; - if (num > (float)num2) - { - num4 = (int)((double)vector.X - num3 * 0.5); - num5 = (int)((double)vector.X + num3 * 0.5); - num6 = (int)((double)vector.Y - num3 * 0.5); - num7 = (int)((double)vector.Y + num3 * 0.5); - if (num4 < 0) - { - num4 = 0; - } - if (num5 > Main.maxTilesX - 1) - { - num5 = Main.maxTilesX - 1; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int k = num4; k < num5; k++) - { - for (int l = num6; l < num7; l++) - { - if ((double)(Math.Abs((float)k - vector.X) + Math.Abs((float)l - vector.Y)) < num3 * 0.5 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) - { - if (ocean) - { - Main.tile[k, l].active(false); - Main.tile[k, l].liquid = 255; - Main.tile[k, l].lava(false); - } - else - { - Main.tile[k, l].active(false); - Main.tile[k, l].liquid = 255; - Main.tile[k, l].lava(true); - } - } - } - } - } - if (num <= 2f && (double)vector.Y < (Main.rockLayer + (double)Main.maxTilesY * 0.3)) - { - num = 2f; - } - vector += vector2; - vector2.X += (float)WorldGen.genRand.Next(-1, 2) * 0.01f; - if ((double)vector2.X > 0.02) - { - vector2.X = 0.02f; - } - if ((double)vector2.X < -0.02) - { - vector2.X = -0.02f; - } - num4 = (int)((double)vector.X - num3 * 1.1); - num5 = (int)((double)vector.X + num3 * 1.1); - num6 = (int)((double)vector.Y - num3 * 1.1); - num7 = (int)((double)vector.Y + num3 * 1.1); - if (num4 < 1) - { - num4 = 1; - } - if (num5 > Main.maxTilesX - 1) - { - num5 = Main.maxTilesX - 1; - } - if (num6 < 0) - { - num6 = 0; - } - if (num7 > Main.maxTilesY) - { - num7 = Main.maxTilesY; - } - for (int m = num4; m < num5; m++) - { - for (int n = num6; n < num7; n++) - { - if ((double)(Math.Abs((float)m - vector.X) + Math.Abs((float)n - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) - { - if (n > j + WorldGen.genRand.Next(7, 16)) - { - Main.tile[m, n].active(false); - } - if (steps <= num2) - { - Main.tile[m, n].active(false); - } - if (ocean) - { - Main.tile[m, n].liquid = 255; - Main.tile[m, n].lava(false); - } - else - { - Main.tile[m, n].liquid = 255; - Main.tile[m, n].lava(true); - } - } - } - } - for (int num11 = num4; num11 < num5; num11++) - { - for (int num12 = num6; num12 < num7; num12++) - { - if ((double)(Math.Abs((float)num11 - vector.X) + Math.Abs((float)num12 - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) - { - if (ocean) - { - Main.tile[num11, num12].liquid = 255; - Main.tile[num11, num12].lava(false); - } - else - { - Main.tile[num11, num12].liquid = 255; - Main.tile[num11, num12].lava(true); - } - if (steps <= num2) - { - Main.tile[num11, num12].active(false); - } - } - } - } - } - } - #endregion - - #region PlaceTits - public static void PlaceTit(int x, int y, ushort type = 165) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - if (Main.tile[x, y - 1] == null) - { - Main.tile[x, y - 1] = new Tile(); - } - if (Main.tile[x, y] == null) - { - Main.tile[x, y] = new Tile(); - } - if (Main.tile[x, y + 1] == null) - { - Main.tile[x, y + 1] = new Tile(); - } - if (WorldGen.SolidTile(x, y - 1) && !Main.tile[x, y].active() && !Main.tile[x, y + 1].active()) - { - if (Main.tile[x, y - 1].type == (ushort)mod.TileType("Navystone")) - { - if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y + 2].active()) - { - int num2 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y].type = type; - Main.tile[x, y].active(true); - Main.tile[x, y].frameX = (short)num2; - Main.tile[x, y].frameY = 72; - } - else - { - int num3 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y].type = type; - Main.tile[x, y].active(true); - Main.tile[x, y].frameX = (short)num3; - Main.tile[x, y].frameY = 0; - Main.tile[x, y + 1].type = type; - Main.tile[x, y + 1].active(true); - Main.tile[x, y + 1].frameX = (short)num3; - Main.tile[x, y + 1].frameY = 18; - } - } - } - else - { - if (WorldGen.SolidTile(x, y + 1) && !Main.tile[x, y].active() && !Main.tile[x, y - 1].active()) - { - if (Main.tile[x, y + 1].type == (ushort)mod.TileType("Navystone")) - { - if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y - 2].active()) - { - int num13 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y].type = type; - Main.tile[x, y].active(true); - Main.tile[x, y].frameX = (short)num13; - Main.tile[x, y].frameY = 90; - } - else - { - int num14 = WorldGen.genRand.Next(3) * 18; - Main.tile[x, y - 1].type = type; - Main.tile[x, y - 1].active(true); - Main.tile[x, y - 1].frameX = (short)num14; - Main.tile[x, y - 1].frameY = 36; - Main.tile[x, y].type = type; - Main.tile[x, y].active(true); - Main.tile[x, y].frameX = (short)num14; - Main.tile[x, y].frameY = 54; - } - } - } - } - } - #endregion - - #region Planetoids - private static void Planetoids(GenerationProgress progress) - { - progress.Message = "Generating Planetoids..."; - - int GrassPlanetoidCount = Main.maxTilesX / 1100; - int LCPlanetoidCount = Main.maxTilesX / 800; - int MudPlanetoidCount = Main.maxTilesX / 1100; - - while (true) - { - if (Biomes.Place(new Point(WorldGen.genRand.Next(Main.maxTilesX / 2 - 300, Main.maxTilesX / 2 + 300), WorldGen.genRand.Next(128, 134)), WorldGen.structures)) - { - break; - } - } - while (LCPlanetoidCount > 0) - { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2), (int)(Main.maxTilesX * 0.8)); - int y = WorldGen.genRand.Next(70, 101); - - bool placed = Biomes.Place(x, y, WorldGen.structures); - - if (placed) - LCPlanetoidCount--; - } - while (GrassPlanetoidCount > 0) - { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.333), (int)(Main.maxTilesX * 0.666)); - int y = WorldGen.genRand.Next(100, 131); - - - bool placed = Biomes.Place(x, y, WorldGen.structures); - - if (placed) - GrassPlanetoidCount--; - } - while (MudPlanetoidCount > 0) - { - int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.3f), (int)(Main.maxTilesX * 0.7f)); - int y = WorldGen.genRand.Next(100, 131); - - bool placed = Biomes.Place(x, y, WorldGen.structures); - - if (placed) - MudPlanetoidCount--; - } - } - #endregion - #region PostUpdate public override void PostUpdate() { @@ -4910,6 +1718,19 @@ namespace CalamityMod NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("EidolonWyrmHeadHuge")); } } + /*if (Main.rand.Next(100000000) == 0) + { + string key = "Mods.CalamityMod.AprilFools"; + Color messageColor = Color.Crimson; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + }*/ #region DeathModeBossSpawns if (death && !CalamityPlayer.areThereAnyDamnBosses && Main.player[closestPlayer].statLifeMax2 >= 300) { @@ -5209,7 +2030,10 @@ namespace CalamityMod NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DesertScourgeHeadSmall")); NPC.SpawnOnPlayer(closestPlayer, mod.NPCType("DesertScourgeHeadSmall")); } - NPC.SpawnOnPlayer(closestPlayer, bossType); + if (bossType == NPCID.DukeFishron) + NPC.NewNPC((int)Main.player[closestPlayer].Center.X - 300, (int)Main.player[closestPlayer].Center.Y - 300, bossType); + else + NPC.SpawnOnPlayer(closestPlayer, bossType); } bossType = 0; if (Main.netMode == 2) diff --git a/Config.cs b/Config.cs index 04ddf55448..8fd6d7df31 100644 --- a/Config.cs +++ b/Config.cs @@ -12,13 +12,21 @@ namespace CalamityMod public static bool ExpertChilledWaterRemoval = true; public static bool ProficiencyEnabled = true; public static bool MiningSpeedBoost = false; - public static bool DisableExpertEnemySpawnsNearHouse = true; + public static bool DisableExpertEnemySpawnsNearHouse = false; public static bool ExpertPillarEnemyKillCountReduction = true; + public static bool LethalLava = true; + + public static bool BossRushAccessoryCurse = false; + public static bool BossRushHealthCurse = false; + public static bool BossRushDashCurse = false; + public static bool BossRushXerocCurse = false; + public static bool BossRushImmunityFrameCurse = false; public static int RageMeterXPos = 500; public static int RageMeterYPos = 30; public static int AdrenalineMeterXPos = 650; public static int AdrenalineMeterYPos = 30; + public static int BossHealthPercentageBoost = 0; static readonly string ConfigPath = Path.Combine(Main.SavePath, "Mod Configs", "CalamityConfig.json"); static Preferences Configuration = new Preferences(ConfigPath); @@ -40,13 +48,21 @@ namespace CalamityMod ExpertChilledWaterRemoval = true; ProficiencyEnabled = true; MiningSpeedBoost = false; - DisableExpertEnemySpawnsNearHouse = true; + DisableExpertEnemySpawnsNearHouse = false; ExpertPillarEnemyKillCountReduction = true; + LethalLava = true; + + BossRushAccessoryCurse = false; + BossRushHealthCurse = false; + BossRushDashCurse = false; + BossRushXerocCurse = false; + BossRushImmunityFrameCurse = false; RageMeterXPos = 500; RageMeterYPos = 30; AdrenalineMeterXPos = 650; AdrenalineMeterYPos = 30; + BossHealthPercentageBoost = 0; } public static bool ReadConfig() @@ -60,11 +76,19 @@ namespace CalamityMod Configuration.Get("MiningSpeedBoost", ref MiningSpeedBoost); Configuration.Get("DisableExpertEnemySpawnsNearHouse", ref DisableExpertEnemySpawnsNearHouse); Configuration.Get("ExpertPillarEnemyKillCountReduction", ref ExpertPillarEnemyKillCountReduction); + Configuration.Get("LethalLava", ref LethalLava); + + Configuration.Get("BossRushAccessoryCurse", ref BossRushAccessoryCurse); + Configuration.Get("BossRushHealthCurse", ref BossRushHealthCurse); + Configuration.Get("BossRushDashCurse", ref BossRushDashCurse); + Configuration.Get("BossRushXerocCurse", ref BossRushXerocCurse); + Configuration.Get("BossRushImmunityFrameCurse", ref BossRushImmunityFrameCurse); Configuration.Get("RageMeterXPos", ref RageMeterXPos); Configuration.Get("RageMeterYPos", ref RageMeterYPos); Configuration.Get("AdrenalineMeterXPos", ref AdrenalineMeterXPos); Configuration.Get("AdrenalineMeterYPos", ref AdrenalineMeterYPos); + Configuration.Get("BossHealthPercentageBoost", ref BossHealthPercentageBoost); return true; } return false; @@ -80,6 +104,13 @@ namespace CalamityMod Configuration.Put("MiningSpeedBoost", MiningSpeedBoost); Configuration.Put("DisableExpertEnemySpawnsNearHouse", DisableExpertEnemySpawnsNearHouse); Configuration.Put("ExpertPillarEnemyKillCountReduction", ExpertPillarEnemyKillCountReduction); + Configuration.Put("LethalLava", LethalLava); + + Configuration.Put("BossRushAccessoryCurse", BossRushAccessoryCurse); + Configuration.Put("BossRushHealthCurse", BossRushHealthCurse); + Configuration.Put("BossRushDashCurse", BossRushDashCurse); + Configuration.Put("BossRushXerocCurse", BossRushXerocCurse); + Configuration.Put("BossRushImmunityFrameCurse", BossRushImmunityFrameCurse); Configuration.Put("RageMeterXPos", RageMeterXPos); if (RageMeterXPos < 0) @@ -93,6 +124,11 @@ namespace CalamityMod Configuration.Put("AdrenalineMeterYPos", AdrenalineMeterYPos); if (AdrenalineMeterYPos < 0) AdrenalineMeterYPos = 0; + Configuration.Put("BossHealthPercentageBoost", BossHealthPercentageBoost); + if (BossHealthPercentageBoost < 0) + BossHealthPercentageBoost = 0; + if (BossHealthPercentageBoost > 900) + BossHealthPercentageBoost = 900; Configuration.Save(); } @@ -101,14 +137,20 @@ namespace CalamityMod public override void NetSend(BinaryWriter writer) { var data = new BitsByte(AdrenalineAndRage, ExpertDebuffDurationReduction, ExpertChilledWaterRemoval, - ProficiencyEnabled, MiningSpeedBoost, DisableExpertEnemySpawnsNearHouse, ExpertPillarEnemyKillCountReduction); + ProficiencyEnabled, MiningSpeedBoost, DisableExpertEnemySpawnsNearHouse, ExpertPillarEnemyKillCountReduction, + LethalLava); + + var data2 = new BitsByte(BossRushAccessoryCurse, BossRushHealthCurse, BossRushDashCurse, + BossRushXerocCurse, BossRushImmunityFrameCurse); writer.Write(data); + writer.Write(data2); writer.Write(RageMeterXPos); writer.Write(RageMeterYPos); writer.Write(AdrenalineMeterXPos); writer.Write(AdrenalineMeterYPos); + writer.Write(BossHealthPercentageBoost); } public override void NetReceive(BinaryReader reader) @@ -123,11 +165,20 @@ namespace CalamityMod MiningSpeedBoost = data[4]; DisableExpertEnemySpawnsNearHouse = data[5]; ExpertPillarEnemyKillCountReduction = data[6]; + LethalLava = data[7]; + + var data2 = (BitsByte)reader.ReadByte(); + BossRushAccessoryCurse = data2[0]; + BossRushHealthCurse = data2[1]; + BossRushDashCurse = data2[2]; + BossRushXerocCurse = data2[3]; + BossRushImmunityFrameCurse = data2[4]; RageMeterXPos = reader.ReadInt32(); RageMeterYPos = reader.ReadInt32(); AdrenalineMeterXPos = reader.ReadInt32(); AdrenalineMeterYPos = reader.ReadInt32(); + BossHealthPercentageBoost = reader.ReadInt32(); } } diff --git a/ExtraTextures/Chains/DragonPowChain.png b/ExtraTextures/Chains/DragonPowChain.png new file mode 100644 index 0000000000..012af80bcb Binary files /dev/null and b/ExtraTextures/Chains/DragonPowChain.png differ diff --git a/Gores/IrradiatedSlime/IrradiatedSlime.png b/Gores/IrradiatedSlime/IrradiatedSlime.png new file mode 100644 index 0000000000..56b811340a Binary files /dev/null and b/Gores/IrradiatedSlime/IrradiatedSlime.png differ diff --git a/Gores/IrradiatedSlime/IrradiatedSlime2.png b/Gores/IrradiatedSlime/IrradiatedSlime2.png new file mode 100644 index 0000000000..3752e9f03c Binary files /dev/null and b/Gores/IrradiatedSlime/IrradiatedSlime2.png differ diff --git a/Items/AbyssItems/AbyssalAmulet.png b/Items/AbyssItems/AbyssalAmulet.png index be96ac38b2..62ef7111f6 100644 Binary files a/Items/AbyssItems/AbyssalAmulet.png and b/Items/AbyssItems/AbyssalAmulet.png differ diff --git a/Items/AbyssItems/DepthCharm.cs b/Items/AbyssItems/DepthCharm.cs index a6c37c2706..247df99a92 100644 --- a/Items/AbyssItems/DepthCharm.cs +++ b/Items/AbyssItems/DepthCharm.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.AbyssItems { DisplayName.SetDefault("Depths Charm"); Tooltip.SetDefault("Reduces the damage caused by the pressure of the abyss while out of breath\n" + - "Removes the bleed effect caused by the abyss"); + "Removes the bleed effect caused by the upper layers of the abyss"); } public override void SetDefaults() diff --git a/Items/AbyssItems/TorrentialTear.png b/Items/AbyssItems/TorrentialTear.png index aed052e4ad..f9d960b2f8 100644 Binary files a/Items/AbyssItems/TorrentialTear.png and b/Items/AbyssItems/TorrentialTear.png differ diff --git a/Items/Accessories/AmalgamatedBrain.png b/Items/Accessories/AmalgamatedBrain.png index a797ed20a0..0c6b178810 100644 Binary files a/Items/Accessories/AmalgamatedBrain.png and b/Items/Accessories/AmalgamatedBrain.png differ diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index 99bb806c22..0b088d096f 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Ambrosial Ampoule"); - Tooltip.SetDefault("50% increased mining speed\n" + + Tooltip.SetDefault("25% increased mining speed\n" + "You emit light\n" + "5% increased damage reduction and increased life regen\n" + "Poison, Freeze, Chill, Frostburn, and Venom immunity\n" + diff --git a/Items/Accessories/AmidiasSpark.cs b/Items/Accessories/AmidiasSpark.cs index df3ec50654..850d7e8278 100644 --- a/Items/Accessories/AmidiasSpark.cs +++ b/Items/Accessories/AmidiasSpark.cs @@ -9,28 +9,28 @@ using CalamityMod.Items; namespace CalamityMod.Items.Accessories { - public class AmidiasSpark : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Amidias' Spark"); - Tooltip.SetDefault("Taking damage releases a blast of sparks\n" + - "Sparks do extra damage in Hardmode"); - } + public class AmidiasSpark : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Amidias' Spark"); + Tooltip.SetDefault("Taking damage releases a blast of sparks\n" + + "Sparks do extra damage in Hardmode"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 3, 0, 0); - item.rare = 1; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 1; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.aSpark = true; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.aSpark = true; + } + } } \ No newline at end of file diff --git a/Items/Accessories/AncientFossil.cs b/Items/Accessories/AncientFossil.cs index b77190e189..70196c5b38 100644 --- a/Items/Accessories/AncientFossil.cs +++ b/Items/Accessories/AncientFossil.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Ancient Fossil"); - Tooltip.SetDefault("Increases pick speed by 35% while underground"); + Tooltip.SetDefault("Increases pick speed by 15% while underground"); } public override void SetDefaults() @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories { if (player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight) { - player.pickSpeed -= 0.35f; + player.pickSpeed -= 0.15f; } } diff --git a/Items/Accessories/ArcanumoftheVoid.cs b/Items/Accessories/ArcanumoftheVoid.cs index 6a0a94d36c..699805575c 100644 --- a/Items/Accessories/ArcanumoftheVoid.cs +++ b/Items/Accessories/ArcanumoftheVoid.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.projRef = true; + modPlayer.projRef = true; } - } + } } \ No newline at end of file diff --git a/Items/Accessories/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs index 7a7219b46c..6f5b976f69 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Archaic Powder"); - Tooltip.SetDefault("50% increased mining speed, 7% damage reduction, and +3 defense while underground or in the underworld"); + Tooltip.SetDefault("20% increased mining speed, 7% damage reduction, and +3 defense while underground or in the underworld"); } public override void SetDefaults() @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Accessories { player.statDefense += 3; player.endurance += 0.07f; - player.pickSpeed -= 0.5f; + player.pickSpeed -= 0.2f; } } diff --git a/Items/Accessories/AstralBulwark.cs b/Items/Accessories/AstralBulwark.cs index 303599dc95..1285f2efde 100644 --- a/Items/Accessories/AstralBulwark.cs +++ b/Items/Accessories/AstralBulwark.cs @@ -32,6 +32,6 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.GetModPlayer(mod); modPlayer.aBulwark = true; player.buffImmune[mod.BuffType("GodSlayerInferno")] = true; - } - } + } + } } \ No newline at end of file diff --git a/Items/Accessories/BadgeofBravery.cs b/Items/Accessories/BadgeofBravery.cs index 79d10a7157..db8a84e687 100644 --- a/Items/Accessories/BadgeofBravery.cs +++ b/Items/Accessories/BadgeofBravery.cs @@ -41,5 +41,13 @@ namespace CalamityMod.Items.Accessories recipe.SetResult(this); recipe.AddRecipe(); } - } + + public override void OnCraft(Recipe recipe) + { + if (Main.rand.Next(40) == 0) + recipe.createItem.type = mod.ItemType("SamuraiBadge"); + else + recipe.createItem.type = item.type; + } + } } \ No newline at end of file diff --git a/Items/Accessories/CheatTestThing.cs b/Items/Accessories/CheatTestThing.cs index 57a966cfe3..3e7cccbbbc 100644 --- a/Items/Accessories/CheatTestThing.cs +++ b/Items/Accessories/CheatTestThing.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.GetModPlayer(mod); - bool canUse = player.name == "Fabsol" && player.townNPCs <= 1; + bool canUse = (player.name == "Fabsol" || player.name == "Totalbiscuit") && player.townNPCs <= 1; if (canUse) { modPlayer.lol = true; diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index 992e8f9713..fc3fe022a4 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories item.width = 26; item.height = 26; item.value = Item.buyPrice(0, 9, 0, 0); - item.rare = 5; + item.rare = 3; item.accessory = true; } diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index 3ee3c1564a..dbbcb962a5 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -14,10 +14,10 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Dark Sun Ring"); - Tooltip.SetDefault("10% increase to damage, minion knockback, and melee speed\n" + - "+1 life regen, 30% increased pick speed, and +2 max minions\n" + - "During the day the player has +2 life regen\n" + - "During the night the player has +20 defense\n" + + Tooltip.SetDefault("12% increase to damage, minion knockback, and melee speed\n" + + "+1 life regen, 15% increased pick speed, and +2 max minions\n" + + "During the day the player has +3 life regen\n" + + "During the night the player has +30 defense\n" + "Contains the power of the dark sun"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 6)); } diff --git a/Items/Accessories/GiantTortoiseShell.cs b/Items/Accessories/GiantTortoiseShell.cs index 04dfc64aee..30e0386fc9 100644 --- a/Items/Accessories/GiantTortoiseShell.cs +++ b/Items/Accessories/GiantTortoiseShell.cs @@ -30,6 +30,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { + CalamityPlayer modPlayer = player.GetModPlayer(mod); player.moveSpeed -= 0.1f; player.thorns = 0.25f; } diff --git a/Items/Accessories/LeadCore.cs b/Items/Accessories/LeadCore.cs index be7eded217..975d093661 100644 --- a/Items/Accessories/LeadCore.cs +++ b/Items/Accessories/LeadCore.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Accessories { item.width = 26; item.height = 26; - item.rare = 10; - item.value = Item.buyPrice(0, 30, 0, 0); + item.rare = 2; + item.value = Item.buyPrice(0, 3, 0, 0); item.accessory = true; } diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index c217e51aba..b28e4e1794 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -22,11 +22,11 @@ namespace CalamityMod.Items.Accessories item.height = 32; item.value = Item.buyPrice(0, 12, 0, 0); item.rare = 5; - item.defense = 6; + item.defense = 8; item.accessory = true; } - public override void AddRecipes() + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "VerstaltiteBar", 5); @@ -35,5 +35,5 @@ namespace CalamityMod.Items.Accessories recipe.SetResult(this); recipe.AddRecipe(); } - } + } } \ No newline at end of file diff --git a/Items/Accessories/PsychoticAmulet.cs b/Items/Accessories/PsychoticAmulet.cs index bca56fc064..3f083f9b5f 100644 --- a/Items/Accessories/PsychoticAmulet.cs +++ b/Items/Accessories/PsychoticAmulet.cs @@ -6,36 +6,38 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; +using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Accessories { - public class PsychoticAmulet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Psychotic Amulet"); - Tooltip.SetDefault("Boosts melee and ranged damage and critical strike chance by 5%\n" + - "Grants a massive boost to these stats if you aren't moving"); - } + public class PsychoticAmulet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Psychotic Amulet"); + Tooltip.SetDefault("Boosts rogue and ranged damage and critical strike chance by 5%\n" + + "Grants a massive boost to these stats if you aren't moving"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = 6; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 15, 0, 0); + item.rare = 6; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.pAmulet = true; - player.shroomiteStealth = true; - player.meleeDamage += 0.05f; - player.meleeCrit += 5; - player.rangedDamage += 0.05f; - player.rangedCrit += 5; - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + CalamityCustomThrowingDamagePlayer modPlayer2 = CalamityCustomThrowingDamagePlayer.ModPlayer(player); + modPlayer.pAmulet = true; + player.shroomiteStealth = true; + modPlayer2.throwingDamage += 0.05f; + modPlayer2.throwingCrit += 5; + player.rangedDamage += 0.05f; + player.rangedCrit += 5; + } + } } \ No newline at end of file diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 9c59d4d308..ce7b893d10 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Raider's Talisman"); Tooltip.SetDefault("Whenever you crit an enemy with a rogue weapon your rogue damage increases\n" + "This effect can stack up to 250 times\n" + - "Max rogue damage boost is 15%"); + "Max rogue damage boost is 25%"); } public override void SetDefaults() diff --git a/Items/Accessories/RareVariants/DeepDiver.cs b/Items/Accessories/RareVariants/DeepDiver.cs new file mode 100644 index 0000000000..fad81bf6e2 --- /dev/null +++ b/Items/Accessories/RareVariants/DeepDiver.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories.RareVariants +{ + public class DeepDiver : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Deep Diver"); + Tooltip.SetDefault("15% increased damage, defense, and movement speed when underwater\n" + + "While underwater you gain the ability to dash great distances"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 28; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 2; + item.defense = 2; + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.deepDiver = true; + modPlayer.dashMod = 5; + } + } + } +} \ No newline at end of file diff --git a/Items/Accessories/RareVariants/DeepDiver.png b/Items/Accessories/RareVariants/DeepDiver.png new file mode 100644 index 0000000000..b1ea717656 Binary files /dev/null and b/Items/Accessories/RareVariants/DeepDiver.png differ diff --git a/Items/Accessories/RareVariants/FabledTortoiseShell.cs b/Items/Accessories/RareVariants/FabledTortoiseShell.cs new file mode 100644 index 0000000000..342a792477 --- /dev/null +++ b/Items/Accessories/RareVariants/FabledTortoiseShell.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories.RareVariants +{ + public class FabledTortoiseShell : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fabled Tortoise Shell"); + Tooltip.SetDefault("50% reduced movement speed\n" + + "Enemies take damage when they hit you\n" + + "You move quickly for a short time if you take damage"); + } + + public override void SetDefaults() + { + item.defense = 50; + item.width = 20; + item.height = 24; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 5; + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.fabledTortoise = true; + player.moveSpeed -= 0.5f; + player.thorns = 0.25f; + player.statDefense += 42; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/RareVariants/FabledTortoiseShell.png b/Items/Accessories/RareVariants/FabledTortoiseShell.png new file mode 100644 index 0000000000..daf93f5fcc Binary files /dev/null and b/Items/Accessories/RareVariants/FabledTortoiseShell.png differ diff --git a/Items/Accessories/RareVariants/HideofAstrumDeus.cs b/Items/Accessories/RareVariants/HideofAstrumDeus.cs new file mode 100644 index 0000000000..109c43ef9d --- /dev/null +++ b/Items/Accessories/RareVariants/HideofAstrumDeus.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories.RareVariants +{ + public class HideofAstrumDeus : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hide of Astrum Deus"); + Tooltip.SetDefault("Taking damage drops an immense amount of astral stars from the sky and boosts true melee damage by 200% for a time\n" + + "Boost duration is based on the amount of damage you took, the higher the damage the longer the boost\n" + + "Provides immunity to the god slayer inferno, cursed inferno, on fire, and frostburn debuffs\n" + + "Enemies take damage when they hit you and are inflicted with the god slayer inferno debuff"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 15, 0, 0); + item.expert = true; + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.aBulwark = true; + player.buffImmune[mod.BuffType("GodSlayerInferno")] = true; + modPlayer.aBulwarkRare = true; + player.buffImmune[BuffID.CursedInferno] = true; + player.buffImmune[BuffID.OnFire] = true; + player.buffImmune[BuffID.Frostburn] = true; + player.thorns += 0.75f; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/RareVariants/HideofAstrumDeus.png b/Items/Accessories/RareVariants/HideofAstrumDeus.png new file mode 100644 index 0000000000..2b113c5362 Binary files /dev/null and b/Items/Accessories/RareVariants/HideofAstrumDeus.png differ diff --git a/Items/Accessories/RareVariants/Regenator.cs b/Items/Accessories/RareVariants/Regenator.cs new file mode 100644 index 0000000000..fccfdb9191 --- /dev/null +++ b/Items/Accessories/RareVariants/Regenator.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories.RareVariants +{ + public class Regenator : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Regenator"); + Tooltip.SetDefault("Reduces max HP by 50% but greatly improves life regeneration"); + } + + public override void SetDefaults() + { + item.width = 36; + item.height = 32; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 5; + item.defense = 6; + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.regenator = true; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/RareVariants/Regenator.png b/Items/Accessories/RareVariants/Regenator.png new file mode 100644 index 0000000000..bb299c9657 Binary files /dev/null and b/Items/Accessories/RareVariants/Regenator.png differ diff --git a/Items/Accessories/RareVariants/SamuraiBadge.cs b/Items/Accessories/RareVariants/SamuraiBadge.cs new file mode 100644 index 0000000000..0e0d7047e7 --- /dev/null +++ b/Items/Accessories/RareVariants/SamuraiBadge.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories.RareVariants +{ + public class SamuraiBadge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Samurai Badge"); + Tooltip.SetDefault("20% increased melee damage and speed\n" + + "Reduces max life by 25%"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.value = Item.buyPrice(0, 21, 0, 0); + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.badgeOfBraveryRare = true; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/RareVariants/SamuraiBadge.png b/Items/Accessories/RareVariants/SamuraiBadge.png new file mode 100644 index 0000000000..eb84be6d15 Binary files /dev/null and b/Items/Accessories/RareVariants/SamuraiBadge.png differ diff --git a/Items/Accessories/RareVariants/TheBee.cs b/Items/Accessories/RareVariants/TheBee.cs new file mode 100644 index 0000000000..c15cc84493 --- /dev/null +++ b/Items/Accessories/RareVariants/TheBee.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories.RareVariants +{ + public class TheBee : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Bee"); + Tooltip.SetDefault("Causes stars to fall and releases bees when injured\n" + + "All projectiles gain bonus damage if you are at full HP\n" + + "The amount of bonus damage is based on your weapon's damage and fire rate\n" + + "Does not work with summons or sentries"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 28; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 4; + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.starCloak = true; + player.bee = true; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.theBee = true; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/RareVariants/TheBee.png b/Items/Accessories/RareVariants/TheBee.png new file mode 100644 index 0000000000..c7459d7e15 Binary files /dev/null and b/Items/Accessories/RareVariants/TheBee.png differ diff --git a/Items/Accessories/RareVariants/TheEvolution.cs b/Items/Accessories/RareVariants/TheEvolution.cs new file mode 100644 index 0000000000..49f92741e0 --- /dev/null +++ b/Items/Accessories/RareVariants/TheEvolution.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories.RareVariants +{ + public class TheEvolution : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Evolution"); + Tooltip.SetDefault("You have a 50% chance to reflect projectiles when they hit you back at the enemy for 1000% their original damage\n" + + "If this effect triggers you get a health regeneration boost for a short time\n" + + "If the same enemy projectile type hits you again you will resist its damage by 15%"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 60, 0, 0); + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.projRefRare = true; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/RareVariants/TheEvolution.png b/Items/Accessories/RareVariants/TheEvolution.png new file mode 100644 index 0000000000..0dea4e456d Binary files /dev/null and b/Items/Accessories/RareVariants/TheEvolution.png differ diff --git a/Items/Accessories/RareVariants/TheTransformer.cs b/Items/Accessories/RareVariants/TheTransformer.cs new file mode 100644 index 0000000000..9b41d24cba --- /dev/null +++ b/Items/Accessories/RareVariants/TheTransformer.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Accessories.RareVariants +{ + public class TheTransformer : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Transformer"); + Tooltip.SetDefault("Taking damage releases a blast of sparks\n" + + "Sparks do extra damage in Hardmode\n" + + "Immunity to Electrified and you resist all elctrical projectile and enemy damage\n" + + "Enemy bullets do half damage to you and are reflected back at the enemy for 800% their original damage"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 1; + item.accessory = true; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.aSparkRare = true; + modPlayer.aSpark = true; + } + } +} \ No newline at end of file diff --git a/Items/Accessories/RareVariants/TheTransformer.png b/Items/Accessories/RareVariants/TheTransformer.png new file mode 100644 index 0000000000..e398bf8076 Binary files /dev/null and b/Items/Accessories/RareVariants/TheTransformer.png differ diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index 9c01111158..816923a79c 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories { if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { - player.statDefense += 5; + player.statDefense += 5; } } @@ -44,5 +44,5 @@ namespace CalamityMod.Items.Accessories recipe.SetResult(this); recipe.AddRecipe(); } - } + } } \ No newline at end of file diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 8aba437f68..5fe39044c0 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -97,8 +97,7 @@ namespace CalamityMod.Items.Accessories { if (player.whoAmI == Main.myPlayer) { - int projectile1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("PoisonousSeawater"), 500, 5f, player.whoAmI, 0f, 0f); - Main.projectile[projectile1].timeLeft = 10; + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("PoisonousSeawater"), 500, 5f, player.whoAmI, 0f, 0f); } } if (player.immune) diff --git a/Items/Accessories/TheDeadlyMicrobe.png b/Items/Accessories/TheDeadlyMicrobe.png deleted file mode 100644 index 13f9a9b669..0000000000 Binary files a/Items/Accessories/TheDeadlyMicrobe.png and /dev/null differ diff --git a/Items/Accessories/TheFirstShadowflame.cs b/Items/Accessories/TheFirstShadowflame.cs index aa66a371e7..c51976ade0 100644 --- a/Items/Accessories/TheFirstShadowflame.cs +++ b/Items/Accessories/TheFirstShadowflame.cs @@ -14,7 +14,9 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("The First Shadowflame"); - Tooltip.SetDefault("One of the first magical artifacts, granted to a disheveled race of humans long ago by the Tyrant King Yharim\nLittle did the humans know of the horrid curse that lied within...\nGrants shadowflame powers to all minions"); + Tooltip.SetDefault("It is said that in the past, Prometheus descended from the heavens to grant man fire.\n" + + "If that were true, then it is surely the demons of hell that would have risen from below to do the same.\n" + + "Minions inflict shadowflame on enemy hits."); } public override void SetDefaults() diff --git a/Items/Armor/AbyssalDivingSuit.cs b/Items/Armor/AbyssalDivingSuit.cs index 1a385f382b..8f54d7081e 100644 --- a/Items/Armor/AbyssalDivingSuit.cs +++ b/Items/Armor/AbyssalDivingSuit.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor "The plates will only take damage if the damage taken is over 50\n" + "After the suit has taken too much damage its armored plates will take 3 minutes to regenerate\n" + "Reduces the damage caused by the pressure of the abyss while out of breath\n" + - "Removes the bleed effect caused by the abyss\n" + + "Removes the bleed effect caused by the abyss in all layers except the deepest one\n" + "Grants the ability to swim and greatly extends underwater breathing\n" + "Provides light underwater and extra mobility on ice\n" + "Provides a moderate amount of light in the abyss\n" + diff --git a/Items/Armor/AtaxiaArmor.cs b/Items/Armor/AtaxiaArmor.cs index 5724556f75..41874affac 100644 --- a/Items/Armor/AtaxiaArmor.cs +++ b/Items/Armor/AtaxiaArmor.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Ataxia Armor"); - Tooltip.SetDefault("+20 max mana and life\n" + + Tooltip.SetDefault("+20 max life\n" + "8% increased damage and 4% increased critical strike chance"); } @@ -31,7 +31,6 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.statManaMax2 += 20; player.statLifeMax2 += 20; player.meleeCrit += 4; player.meleeDamage += 0.08f; diff --git a/Items/Armor/AtaxiaMask.cs b/Items/Armor/AtaxiaMask.cs index 69337495bf..616ce2a787 100644 --- a/Items/Armor/AtaxiaMask.cs +++ b/Items/Armor/AtaxiaMask.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Ataxia Mask"); Tooltip.SetDefault("12% increased magic damage, reduces mana usage by 10%, and 10% increased magic critical strike chance\n" + - "+100 Max Mana\n" + + "+100 max mana\n" + "Temporary immunity to lava and immunity to fire damage"); } diff --git a/Items/Armor/AuricTeslaBodyArmor.cs b/Items/Armor/AuricTeslaBodyArmor.cs index e427a3d0dd..01f4e35b3e 100644 --- a/Items/Armor/AuricTeslaBodyArmor.cs +++ b/Items/Armor/AuricTeslaBodyArmor.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Auric Tesla Body Armor"); - Tooltip.SetDefault("+100 max life and mana\n" + + Tooltip.SetDefault("+100 max life\n" + "25% increased movement speed\n" + "Attacks have a 2% chance to do no damage to you\n" + "8% increased damage and 5% increased critical strike chance\n" + @@ -38,7 +38,6 @@ namespace CalamityMod.Items.Armor modPlayer.fBarrier = true; modPlayer.godSlayerReflect = true; player.statLifeMax2 += 100; - player.statManaMax2 += 100; player.moveSpeed += 0.25f; player.meleeDamage += 0.08f; player.meleeCrit += 5; diff --git a/Items/Armor/AuricTeslaHelm.cs b/Items/Armor/AuricTeslaHelm.cs index 9154471758..12c6d5ee36 100644 --- a/Items/Armor/AuricTeslaHelm.cs +++ b/Items/Armor/AuricTeslaHelm.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "Melee Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%\n" + "Your melee damage is multiplied based on how high your HP is; at full HP this effect is at max"; diff --git a/Items/Armor/AuricTeslaHoodedFacemask.cs b/Items/Armor/AuricTeslaHoodedFacemask.cs index ff7dc9010c..76008a4958 100644 --- a/Items/Armor/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/AuricTeslaHoodedFacemask.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "Ranged Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%"; CalamityPlayer modPlayer = player.GetModPlayer(mod); diff --git a/Items/Armor/AuricTeslaPlumedHelm.cs b/Items/Armor/AuricTeslaPlumedHelm.cs index 38604aed1c..cb21928dfd 100644 --- a/Items/Armor/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/AuricTeslaPlumedHelm.cs @@ -42,7 +42,6 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "Rogue Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%\n" + "Rogue weapon critical strikes will do 1.25 times damage while you are above 50% HP\n" + diff --git a/Items/Armor/AuricTeslaSpaceHelmet.cs b/Items/Armor/AuricTeslaSpaceHelmet.cs index 707f0d4e6a..b884cfde19 100644 --- a/Items/Armor/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/AuricTeslaSpaceHelmet.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "Summoner Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%\n" + "120% increased minion damage"; diff --git a/Items/Armor/AuricTeslaWireHemmedVisage.cs b/Items/Armor/AuricTeslaWireHemmedVisage.cs index 641ebd3986..561e13e3f4 100644 --- a/Items/Armor/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/AuricTeslaWireHemmedVisage.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Auric Tesla Wire-Hemmed Visage"); - Tooltip.SetDefault("20% increased magic damage and critical strike chance\n" + + Tooltip.SetDefault("20% increased magic damage and critical strike chance and +100 max mana\n" + "Not moving boosts all damage and critical strike chance"); } @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { player.setBonus = "Magic Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%"; CalamityPlayer modPlayer = player.GetModPlayer(mod); @@ -71,7 +70,8 @@ namespace CalamityMod.Items.Armor modPlayer.auricBoost = true; player.magicDamage += 0.2f; player.magicCrit += 20; - } + player.statManaMax2 += 100; + } public override void AddRecipes() { diff --git a/Items/Armor/BloodflareBodyArmor.cs b/Items/Armor/BloodflareBodyArmor.cs index 11dad65f7c..d6c963e61c 100644 --- a/Items/Armor/BloodflareBodyArmor.cs +++ b/Items/Armor/BloodflareBodyArmor.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor DisplayName.SetDefault("Bloodflare Body Armor"); Tooltip.SetDefault("12% increased damage and 8% increased critical strike chance\n" + "You regenerate life quickly and gain +30 defense while in lava\n" + - "+40 max life and mana"); + "+40 max life"); } public override void SetDefaults() @@ -33,7 +33,6 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.statLifeMax2 += 40; - player.statManaMax2 += 40; player.meleeDamage += 0.12f; player.meleeCrit += 8; player.magicDamage += 0.12f; diff --git a/Items/Armor/BloodflareHornedMask.cs b/Items/Armor/BloodflareHornedMask.cs index a0ea126773..127ad9979d 100644 --- a/Items/Armor/BloodflareHornedMask.cs +++ b/Items/Armor/BloodflareHornedMask.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Bloodflare Horned Mask"); Tooltip.SetDefault("You can move freely through liquids and have temporary immunity to lava\n" + - "10% increased magic damage and critical strike chance"); + "10% increased magic damage and critical strike chance and +100 max mana"); } public override void SetDefaults() @@ -58,7 +58,8 @@ namespace CalamityMod.Items.Armor player.ignoreWater = true; player.magicDamage += 0.1f; player.magicCrit += 10; - } + player.statManaMax2 += 100; + } public override void AddRecipes() { diff --git a/Items/Armor/DaedalusHat.cs b/Items/Armor/DaedalusHat.cs index e00b5ad473..4a1636a741 100644 --- a/Items/Armor/DaedalusHat.cs +++ b/Items/Armor/DaedalusHat.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Daedalus Hood"); Tooltip.SetDefault("10% increased magic damage and critical strike chance\n" + - "Immune to Cursed and gives control over gravity"); + "Immune to Cursed, gives control over gravity, and +50 max mana"); } public override void SetDefaults() @@ -55,7 +55,8 @@ namespace CalamityMod.Items.Armor player.magicCrit += 10; player.AddBuff(BuffID.Gravitation, 2); player.buffImmune[BuffID.Cursed] = true; - } + player.statManaMax2 += 50; + } public override void AddRecipes() { diff --git a/Items/Armor/GodSlayerChestplate.cs b/Items/Armor/GodSlayerChestplate.cs index 3fc92c3092..987cf71b92 100644 --- a/Items/Armor/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayerChestplate.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("God Slayer Chestplate"); - Tooltip.SetDefault("+60 max life and mana\n" + + Tooltip.SetDefault("+60 max life\n" + "15% increased movement speed\n" + "Enemies take damage when they hit you\n" + "Attacks have a 2% chance to do no damage to you\n" + @@ -38,7 +38,6 @@ namespace CalamityMod.Items.Armor modPlayer.godSlayerReflect = true; player.thorns += 0.5f; player.statLifeMax2 += 60; - player.statManaMax2 += 60; player.moveSpeed += 0.15f; player.meleeDamage += 0.11f; player.meleeCrit += 6; diff --git a/Items/Armor/GodSlayerVisage.cs b/Items/Armor/GodSlayerVisage.cs index e894cd6257..c606fd0515 100644 --- a/Items/Armor/GodSlayerVisage.cs +++ b/Items/Armor/GodSlayerVisage.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("God Slayer Visage"); - Tooltip.SetDefault("14% increased magic damage and critical strike chance"); + Tooltip.SetDefault("14% increased magic damage and critical strike chance\n" + + "+100 max mana"); } public override void SetDefaults() @@ -53,7 +54,8 @@ namespace CalamityMod.Items.Armor { player.magicDamage += 0.14f; player.magicCrit += 14; - } + player.statManaMax2 += 100; + } public override void AddRecipes() { diff --git a/Items/Armor/MolluskShellmet.cs b/Items/Armor/MolluskShellmet.cs index f7be7e691e..2c4662e808 100644 --- a/Items/Armor/MolluskShellmet.cs +++ b/Items/Armor/MolluskShellmet.cs @@ -8,81 +8,80 @@ using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Armor { - [AutoloadEquip(EquipType.Head)] - public class MolluskShellmet : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Mollusk Shellmet"); - Tooltip.SetDefault("5% increased damage and 4% increased critical strike chance\n" + - "7% decreased movement speed\n" + + [AutoloadEquip(EquipType.Head)] + public class MolluskShellmet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mollusk Shellmet"); + Tooltip.SetDefault("5% increased damage and 4% increased critical strike chance\n" + "You can move freely through liquids"); - } + } - public override void SetDefaults() - { - item.width = 22; - item.height = 22; + public override void SetDefaults() + { + item.width = 22; + item.height = 22; item.value = Item.buyPrice(0, 25, 0, 0); item.rare = 5; - item.defense = 18; - } + item.defense = 18; + } - public override void UpdateEquip(Player player) - { + public override void UpdateEquip(Player player) + { player.ignoreWater = true; - const float damageUp = 0.05f; - const int critUp = 4; - player.meleeDamage += damageUp; - player.rangedDamage += damageUp; - player.magicDamage += damageUp; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += damageUp; - player.minionDamage += damageUp; - player.meleeCrit += critUp; - player.rangedCrit += critUp; - player.magicCrit += critUp; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += critUp; - player.moveSpeed -= 0.07f; - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == mod.ItemType("MolluskShellplate") && legs.type == mod.ItemType("MolluskShelleggings"); - } + const float damageUp = 0.05f; + const int critUp = 4; + player.meleeDamage += damageUp; + player.rangedDamage += damageUp; + player.magicDamage += damageUp; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += damageUp; + player.minionDamage += damageUp; + player.meleeCrit += critUp; + player.rangedCrit += critUp; + player.magicCrit += critUp; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += critUp; + } - public override void UpdateArmorSet(Player player) - { - player.setBonus = "Two shellfishes aid you in combat\n" + - "10% increased damage"; + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == mod.ItemType("MolluskShellplate") && legs.type == mod.ItemType("MolluskShelleggings"); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "Two shellfishes aid you in combat\n" + + "10% increased damage\n" + + "Your horizontal movement is slowed"; const float damageUp = 0.10f; - player.meleeDamage += damageUp; - player.rangedDamage += damageUp; - player.magicDamage += damageUp; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += damageUp; - player.minionDamage += damageUp; - player.GetModPlayer().molluskSet = true; + player.meleeDamage += damageUp; + player.rangedDamage += damageUp; + player.magicDamage += damageUp; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += damageUp; + player.minionDamage += damageUp; + player.GetModPlayer().molluskSet = true; player.maxMinions += 4; if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(mod.BuffType("Shellfish")) == -1) - { - player.AddBuff(mod.BuffType("Shellfish"), 3600, true); - } - if (player.ownedProjectileCounts[mod.ProjectileType("Shellfish")] < 2) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("Shellfish"), (int)((double)1500 * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); - } - } - } + { + if (player.FindBuffIndex(mod.BuffType("Shellfish")) == -1) + { + player.AddBuff(mod.BuffType("Shellfish"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("Shellfish")] < 2) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("Shellfish"), (int)((double)1500 * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); + } + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("SeaPrism"), 15); - recipe.AddIngredient(mod.ItemType("MolluskHusk"), 6); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("SeaPrism"), 15); + recipe.AddIngredient(mod.ItemType("MolluskHusk"), 6); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Armor/ReaverMask.cs b/Items/Armor/ReaverMask.cs index 858273295f..7c25ffb69f 100644 --- a/Items/Armor/ReaverMask.cs +++ b/Items/Armor/ReaverMask.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Reaver Mask"); Tooltip.SetDefault("10% increased magic damage, 5% reduced mana cost, and 5% increased magic critical strike chance\n" + - "10% increased movement speed and can move freely through liquids"); + "10% increased movement speed, can move freely through liquids, and +75 max mana"); } public override void SetDefaults() @@ -56,7 +56,8 @@ namespace CalamityMod.Items.Armor player.magicCrit += 5; player.manaCost *= 0.95f; player.moveSpeed += 0.1f; - } + player.statManaMax2 += 75; + } public override void AddRecipes() { diff --git a/Items/Armor/SilvaArmor.cs b/Items/Armor/SilvaArmor.cs index c2c46f4e87..397064a148 100644 --- a/Items/Armor/SilvaArmor.cs +++ b/Items/Armor/SilvaArmor.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Silva Armor"); - Tooltip.SetDefault("+80 max life and mana\n" + + Tooltip.SetDefault("+80 max life\n" + "20% increased movement speed\n" + "12% increased damage and 8% increased critical strike chance"); } @@ -33,7 +33,6 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.statLifeMax2 += 80; - player.statManaMax2 += 80; player.moveSpeed += 0.2f; player.meleeDamage += 0.12f; player.meleeCrit += 8; diff --git a/Items/Armor/SilvaHelm.cs b/Items/Armor/SilvaHelm.cs index 3debd76fb2..c4f7e245a4 100644 --- a/Items/Armor/SilvaHelm.cs +++ b/Items/Armor/SilvaHelm.cs @@ -43,12 +43,11 @@ namespace CalamityMod.Items.Armor modPlayer.silvaSet = true; modPlayer.silvaMelee = true; player.setBonus = "You are immune to almost all debuffs\n" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life\n" + + "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + "Your max life will return to normal if you die\n" + "True melee strikes have a 25% chance to do five times damage\n" + "After the silva invincibility is over you will take 20% less contact damage\n" + diff --git a/Items/Armor/SilvaHelmet.cs b/Items/Armor/SilvaHelmet.cs index 9656b04247..45d04bee4c 100644 --- a/Items/Armor/SilvaHelmet.cs +++ b/Items/Armor/SilvaHelmet.cs @@ -44,12 +44,11 @@ namespace CalamityMod.Items.Armor modPlayer.silvaSummon = true; player.setBonus = "75% increased minion damage\n" + "You are immune to almost all debuffs\n" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life\n" + + "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + "Your max life will return to normal if you die\n" + "Summons an ancient leaf prism to blast your enemies with life energy\n" + "After the silva invulnerability time your minions will deal 10% more damage and you will gain +2 max minions"; diff --git a/Items/Armor/SilvaHornedHelm.cs b/Items/Armor/SilvaHornedHelm.cs index 0682675130..ad1d94e723 100644 --- a/Items/Armor/SilvaHornedHelm.cs +++ b/Items/Armor/SilvaHornedHelm.cs @@ -43,12 +43,11 @@ namespace CalamityMod.Items.Armor modPlayer.silvaSet = true; modPlayer.silvaRanged = true; player.setBonus = "You are immune to almost all debuffs\n" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life\n" + + "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + "Your max life will return to normal if you die\n" + "Increases your rate of fire with all ranged weapons\n" + "During the silva invulnerability time your ranged weapons will do 40% more damage"; diff --git a/Items/Armor/SilvaMask.cs b/Items/Armor/SilvaMask.cs index 63a1b9a2da..8d90942c9d 100644 --- a/Items/Armor/SilvaMask.cs +++ b/Items/Armor/SilvaMask.cs @@ -45,12 +45,11 @@ namespace CalamityMod.Items.Armor modPlayer.silvaThrowing = true; modPlayer.rogueStealthMax = 1.5f; player.setBonus = "You are immune to almost all debuffs\n" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life\n" + + "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + "Your max life will return to normal if you die\n" + "Rogue weapons have a faster throwing rate while you are above 50% life\n" + "After the silva invulnerability time your rogue weapons will do 10% more damage\n" + diff --git a/Items/Armor/SilvaMaskedCap.cs b/Items/Armor/SilvaMaskedCap.cs index 8963f59598..e8cecaec35 100644 --- a/Items/Armor/SilvaMaskedCap.cs +++ b/Items/Armor/SilvaMaskedCap.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Silva Masked Cap"); - Tooltip.SetDefault("13% increased magic damage and critical strike chance"); + Tooltip.SetDefault("13% increased magic damage and critical strike chance\n" + + "+100 max mana"); } public override void SetDefaults() @@ -43,12 +44,11 @@ namespace CalamityMod.Items.Armor modPlayer.silvaSet = true; modPlayer.silvaMage = true; player.setBonus = "You are immune to almost all debuffs\n" + - "Reduces all damage taken by 5%, this is calculated separately from damage reduction\n" + "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + "If you are reduced to 1 HP you will not die from any further damage for 10 seconds\n" + "If you get reduced to 1 HP again while this effect is active you will lose 100 max life\n" + - "This effect only triggers once per life\n" + + "This effect only triggers once per life and if you are reduced to 400 max life the invincibility effect will stop\n" + "Your max life will return to normal if you die\n" + "Magic projectiles have a 10% chance to cause a massive explosion on enemy hits\n" + "After the silva invulnerability time your magic weapons will do 10% more damage"; @@ -58,7 +58,8 @@ namespace CalamityMod.Items.Armor { player.magicDamage += 0.13f; player.magicCrit += 13; - } + player.statManaMax2 += 100; + } public override void AddRecipes() { diff --git a/Items/Armor/SirensHeart.cs b/Items/Armor/SirensHeart.cs index 7d4915d7c4..1b8b55cb5d 100644 --- a/Items/Armor/SirensHeart.cs +++ b/Items/Armor/SirensHeart.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor "Going underwater gives you a buff\n" + "Greatly reduces breath loss in the abyss\n" + "Enemies become frozen when they touch you\n" + - "You have a layer of ice around you that absorbs 20% damage but breaks after one hit\n" + + "You have a layer of ice around you that absorbs 15% damage but breaks after one hit\n" + "After 30 seconds the ice shield will regenerate\n" + "Your alluring figure allows you to buy items at a reduced price from town npcs (only works in hardmode)\n" + "Wow, you can swim now!\n" + diff --git a/Items/Armor/SirensHeartAlt.cs b/Items/Armor/SirensHeartAlt.cs index 1bb654d9f2..7bda159e4c 100644 --- a/Items/Armor/SirensHeartAlt.cs +++ b/Items/Armor/SirensHeartAlt.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor "Going underwater gives you a buff\n" + "Greatly reduces breath loss in the abyss\n" + "Enemies become frozen when they touch you\n" + - "You have a layer of ice around you that absorbs 20% damage but breaks after one hit\n" + + "You have a layer of ice around you that absorbs 15% damage but breaks after one hit\n" + "After 30 seconds the ice shield will regenerate\n" + "Your alluring figure allows you to buy items at a reduced price from town npcs (only works in hardmode)\n" + "Wow, you can swim now!\n" + diff --git a/Items/Armor/StatigelCap.cs b/Items/Armor/StatigelCap.cs index 4483f42f64..7fbeaa4e14 100644 --- a/Items/Armor/StatigelCap.cs +++ b/Items/Armor/StatigelCap.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Statigel Cap"); Tooltip.SetDefault("10% increased magic damage and 10% decreased mana cost\n" + - "7% increased magic critical strike chance"); + "7% increased magic critical strike chance and +30 max mana"); } public override void SetDefaults() @@ -48,7 +48,8 @@ namespace CalamityMod.Items.Armor player.magicDamage += 0.1f; player.magicCrit += 7; player.manaCost *= 0.9f; - } + player.statManaMax2 += 30; + } public override void AddRecipes() { diff --git a/Items/Armor/TarragonBreastplate.cs b/Items/Armor/TarragonBreastplate.cs index 8a6ce8ded0..8efa432380 100644 --- a/Items/Armor/TarragonBreastplate.cs +++ b/Items/Armor/TarragonBreastplate.cs @@ -17,8 +17,7 @@ namespace CalamityMod.Items.Armor { DisplayName.SetDefault("Tarragon Breastplate"); Tooltip.SetDefault("10% increased damage and 5% increased critical strike chance\n" + - "+2 life regen\n" + - "+40 max life and mana\n" + + "+2 life regen and +40 max life\n" + "Breastplate of the exiler"); } @@ -35,7 +34,6 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.statLifeMax2 += 40; - player.statManaMax2 += 40; player.meleeDamage += 0.1f; player.meleeCrit += 5; player.magicDamage += 0.1f; diff --git a/Items/Armor/TarragonMask.cs b/Items/Armor/TarragonMask.cs index 62b9350168..61e3bc8243 100644 --- a/Items/Armor/TarragonMask.cs +++ b/Items/Armor/TarragonMask.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor Tooltip.SetDefault("Temporary immunity to lava and immunity to cursed inferno, fire, cursed, and chilled debuffs\n" + "Can move freely through liquids\n" + "10% increased magic damage and critical strike chance\n" + - "5% increased damage reduction"); + "5% increased damage reduction and +100 max mana"); } public override void SetDefaults() @@ -60,6 +60,7 @@ namespace CalamityMod.Items.Armor player.magicCrit += 10; player.endurance += 0.05f; player.lavaMax += 240; + player.statManaMax2 += 100; player.ignoreWater = true; player.buffImmune[BuffID.CursedInferno] = true; player.buffImmune[BuffID.OnFire] = true; diff --git a/Items/Armor/XerocPlateMail.cs b/Items/Armor/XerocPlateMail.cs index a0636f480b..96fd699b75 100644 --- a/Items/Armor/XerocPlateMail.cs +++ b/Items/Armor/XerocPlateMail.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { DisplayName.SetDefault("Xeroc Plate Mail"); - Tooltip.SetDefault("+20 max life and mana\n" + + Tooltip.SetDefault("+20 max life\n" + "6% increased movement speed\n" + "7% increased rogue damage and critical strike chance\n" + "Armor of the cosmos"); @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { player.statLifeMax2 += 20; - player.statManaMax2 += 20; player.moveSpeed += 0.06f; CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingCrit += 7; CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.07f; diff --git a/Items/AstrumDeus/AstrumDeusBag.cs b/Items/AstrumDeus/AstrumDeusBag.cs index 68e7d954f4..a0d1999e26 100644 --- a/Items/AstrumDeus/AstrumDeusBag.cs +++ b/Items/AstrumDeus/AstrumDeusBag.cs @@ -49,6 +49,14 @@ namespace CalamityMod.Items.AstrumDeus } } } + if (Main.rand.Next(40) == 0) + { + player.QuickSpawnItem(mod.ItemType("Quasar")); + } + if (Main.rand.Next(40) == 0) + { + player.QuickSpawnItem(mod.ItemType("HideofAstrumDeus")); + } player.TryGettingDevArmor(); player.QuickSpawnItem(mod.ItemType("Stardust"), Main.rand.Next(60, 91)); if (Main.rand.Next(4) == 0) diff --git a/Items/BloodstoneCore.cs b/Items/BloodstoneCore.cs index 912406ad75..34c0934d9f 100644 --- a/Items/BloodstoneCore.cs +++ b/Items/BloodstoneCore.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Items item.width = 15; item.height = 12; item.maxStack = 999; + item.rare = 10; item.value = Item.buyPrice(0, 7, 0, 0); item.GetGlobalItem(mod).postMoonLordRarity = 13; } diff --git a/Items/Brimrose.cs b/Items/Brimrose.cs index 15d064d0b3..f14faeee6e 100644 --- a/Items/Brimrose.cs +++ b/Items/Brimrose.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Items item.useAnimation = 20; item.useStyle = 1; item.value = Item.buyPrice(1, 50, 0, 0); + item.rare = 10; item.expert = true; item.UseSound = SoundID.Item3; item.noMelee = true; diff --git a/Items/Bumblefuck/BirbPheromones.cs b/Items/Bumblefuck/BirbPheromones.cs index 8c5f67de47..5449089f99 100644 --- a/Items/Bumblefuck/BirbPheromones.cs +++ b/Items/Bumblefuck/BirbPheromones.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.Bumblefuck public override void SetStaticDefaults() { DisplayName.SetDefault("Birb Pheromones"); - Tooltip.SetDefault("Attracts the bumbling birb\n" + - "Summons the Bumblebirb"); + Tooltip.SetDefault("Attracts the bumbling birb"); } public override void SetDefaults() diff --git a/Items/Bumblefuck/BumblebirbBag.cs b/Items/Bumblefuck/BumblebirbBag.cs index 828f8c32c6..0e42714e3d 100644 --- a/Items/Bumblefuck/BumblebirbBag.cs +++ b/Items/Bumblefuck/BumblebirbBag.cs @@ -50,6 +50,10 @@ namespace CalamityMod.Items.Bumblefuck } } player.TryGettingDevArmor(); + if (Main.rand.Next(40) == 0) + { + player.QuickSpawnItem(mod.ItemType("Swordsplosion")); + } switch (Main.rand.Next(3)) { case 0: diff --git a/Items/CadencePotion.cs b/Items/CadencePotion.cs deleted file mode 100644 index 133cb46b35..0000000000 --- a/Items/CadencePotion.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class CadencePotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cadance Potion"); - Tooltip.SetDefault("Gives the cadence buff which reduces shop prices and enemy aggro\n" + - "Increases life regen and increases max life by 10%\n" + - "Increases heart pickup range"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Cadence"); - item.buffTime = 18000; - item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.LovePotion); - recipe.AddIngredient(ItemID.HeartreachPotion); - recipe.AddIngredient(ItemID.LifeforcePotion); - recipe.AddIngredient(ItemID.RegenerationPotion); - recipe.AddIngredient(ItemID.CalmingPotion); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 40); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file diff --git a/Items/Calamitas/BlightedEyeball.cs b/Items/Calamitas/BlightedEyeball.cs index 7b5c75f453..998bcd3d5a 100644 --- a/Items/Calamitas/BlightedEyeball.cs +++ b/Items/Calamitas/BlightedEyeball.cs @@ -10,19 +10,19 @@ namespace CalamityMod.Items.Calamitas { DisplayName.SetDefault("Eye of Desolation"); Tooltip.SetDefault("Tonight is going to be a horrific night...\n" + - "Summons Calamitas"); + "Summons Calamitas\n" + + "Not consumable"); } public override void SetDefaults() { item.width = 28; item.height = 18; - item.maxStack = 20; item.rare = 6; item.useAnimation = 45; item.useTime = 45; item.useStyle = 4; - item.consumable = true; + item.consumable = false; } public override bool CanUseItem(Player player) diff --git a/Items/Calamitas/CalamitasBag.png b/Items/Calamitas/CalamitasBag.png index b41a82cfc3..c5fc2d66d2 100644 Binary files a/Items/Calamitas/CalamitasBag.png and b/Items/Calamitas/CalamitasBag.png differ diff --git a/Items/Calamitas/CalamityDust.png b/Items/Calamitas/CalamityDust.png index 74b83459a5..5565101405 100644 Binary files a/Items/Calamitas/CalamityDust.png and b/Items/Calamitas/CalamityDust.png differ diff --git a/Items/Calamitas/CalamityRing.png b/Items/Calamitas/CalamityRing.png index 3f939973d3..fa06932b0c 100644 Binary files a/Items/Calamitas/CalamityRing.png and b/Items/Calamitas/CalamityRing.png differ diff --git a/Items/CalamitousEssence.cs b/Items/CalamitousEssence.cs index e63a01b1cd..2c555059cd 100644 --- a/Items/CalamitousEssence.cs +++ b/Items/CalamitousEssence.cs @@ -30,6 +30,7 @@ namespace CalamityMod.Items item.width = 10; item.height = 14; item.maxStack = 999; + item.rare = 10; item.value = Item.buyPrice(0, 10, 0, 0); item.GetGlobalItem(mod).postMoonLordRarity = 20; } diff --git a/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs b/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs index c5844a93ee..66d84c9ff5 100644 --- a/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs +++ b/Items/CalamityCustomThrowingDamage/AdamantiteThrowingAxe.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("AdamantiteThrowingAxeProjectile"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs b/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs index b1b2c10adb..2e7f8e9958 100644 --- a/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs +++ b/Items/CalamityCustomThrowingDamage/BallisticPoisonBomb.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("BallisticPoisonBomb"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/BrackishFlask.cs b/Items/CalamityCustomThrowingDamage/BrackishFlask.cs index ff1de3b762..23a9878b3d 100644 --- a/Items/CalamityCustomThrowingDamage/BrackishFlask.cs +++ b/Items/CalamityCustomThrowingDamage/BrackishFlask.cs @@ -34,7 +34,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("BrackishFlask"); item.shootSpeed = 12f; - } + item.GetGlobalItem(mod).rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/Brimblade.cs b/Items/CalamityCustomThrowingDamage/Brimblade.cs index 5d27872a5d..2278c616c9 100644 --- a/Items/CalamityCustomThrowingDamage/Brimblade.cs +++ b/Items/CalamityCustomThrowingDamage/Brimblade.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 6; item.shoot = mod.ProjectileType("Brimblade"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs b/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs index b2ec42eba9..e2869599d9 100644 --- a/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs +++ b/Items/CalamityCustomThrowingDamage/CalamityDamageItem.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void GetWeaponDamage(Player player, ref int damage) { - //damage = (int)((float)damage / (player.rangedDamage + 5E-06f)); //change base damage back to normal after all ranged boosts damage = (int)((double)item.damage * (double)(CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage + 5E-06f)); //plus one otherwise weird shit happens } diff --git a/Items/CalamityCustomThrowingDamage/CobaltKunai.cs b/Items/CalamityCustomThrowingDamage/CobaltKunai.cs index bd0f6da7b0..266350f729 100644 --- a/Items/CalamityCustomThrowingDamage/CobaltKunai.cs +++ b/Items/CalamityCustomThrowingDamage/CobaltKunai.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("CobaltKunaiProjectile"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/CraniumSmasher.cs b/Items/CalamityCustomThrowingDamage/CraniumSmasher.cs new file mode 100644 index 0000000000..41742cc86f --- /dev/null +++ b/Items/CalamityCustomThrowingDamage/CraniumSmasher.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage +{ + public class CraniumSmasher : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cranium Smasher"); + Tooltip.SetDefault("Throws disks that roll on the ground, occasionally launches an explosive disk"); + } + + public override void SafeSetDefaults() + { + item.width = 50; + item.height = 50; + item.damage = 140; + item.noMelee = true; + item.noUseGraphic = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 15; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("CraniumSmasher"); + item.shootSpeed = 20f; + item.GetGlobalItem(mod).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) + { + if (Main.rand.Next(0, 5) == 0) + { + damage = (int)(damage * 1.25f); + type = mod.ProjectileType("CraniumSmasherExplosive"); + } + else + { + type = mod.ProjectileType("CraniumSmasher"); + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/CraniumSmasher.png b/Items/CalamityCustomThrowingDamage/CraniumSmasher.png new file mode 100644 index 0000000000..ee328a69cc Binary files /dev/null and b/Items/CalamityCustomThrowingDamage/CraniumSmasher.png differ diff --git a/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs b/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs index 9c6f5af94c..8296888c8a 100644 --- a/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs +++ b/Items/CalamityCustomThrowingDamage/CrushsawCrasher.cs @@ -31,7 +31,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("Crushax"); item.shootSpeed = 11f; - } + item.GetGlobalItem(mod).rogue = true; + } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { diff --git a/Items/CalamityCustomThrowingDamage/CrushsawCrasher.png b/Items/CalamityCustomThrowingDamage/CrushsawCrasher.png index 160b21d10d..f65ccb9564 100644 Binary files a/Items/CalamityCustomThrowingDamage/CrushsawCrasher.png and b/Items/CalamityCustomThrowingDamage/CrushsawCrasher.png differ diff --git a/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs b/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs index 234475bbeb..731c1de1ea 100644 --- a/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs +++ b/Items/CalamityCustomThrowingDamage/CrystalPiercer.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("CrystalPiercerProjectile"); item.shootSpeed = 20f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/Crystalline.cs b/Items/CalamityCustomThrowingDamage/Crystalline.cs index d2caec04c0..749832304f 100644 --- a/Items/CalamityCustomThrowingDamage/Crystalline.cs +++ b/Items/CalamityCustomThrowingDamage/Crystalline.cs @@ -34,6 +34,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 2; item.shoot = mod.ProjectileType("Crystalline"); item.shootSpeed = 10f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/CursedDagger.cs b/Items/CalamityCustomThrowingDamage/CursedDagger.cs index e1c65afdc7..ce7f84d463 100644 --- a/Items/CalamityCustomThrowingDamage/CursedDagger.cs +++ b/Items/CalamityCustomThrowingDamage/CursedDagger.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("CursedDagger"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs b/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs index 374beb7c53..d3e292fd96 100644 --- a/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs +++ b/Items/CalamityCustomThrowingDamage/DuststormInABottle.cs @@ -34,7 +34,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("DuststormInABottle"); item.shootSpeed = 12f; - } + item.GetGlobalItem(mod).rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.png b/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.png index 15b3e46fbc..23985d4fdc 100644 Binary files a/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.png and b/Items/CalamityCustomThrowingDamage/EmpyreanKnivesThrown.png differ diff --git a/Items/CalamityCustomThrowingDamage/FeatherKnife.cs b/Items/CalamityCustomThrowingDamage/FeatherKnife.cs index 1320185c68..c145f715af 100644 --- a/Items/CalamityCustomThrowingDamage/FeatherKnife.cs +++ b/Items/CalamityCustomThrowingDamage/FeatherKnife.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 3; item.shoot = mod.ProjectileType("FeatherKnifeProjectile"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/FlameScythe.cs b/Items/CalamityCustomThrowingDamage/FlameScythe.cs index c9aa3be5e5..0de2891466 100644 --- a/Items/CalamityCustomThrowingDamage/FlameScythe.cs +++ b/Items/CalamityCustomThrowingDamage/FlameScythe.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 8; item.shoot = mod.ProjectileType("FlameScytheProjectile"); item.shootSpeed = 16f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/FrostyFlare.cs b/Items/CalamityCustomThrowingDamage/FrostyFlare.cs index 4ea1db00ad..a4e5fe41b5 100644 --- a/Items/CalamityCustomThrowingDamage/FrostyFlare.cs +++ b/Items/CalamityCustomThrowingDamage/FrostyFlare.cs @@ -12,8 +12,10 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Frosty Flare"); - Tooltip.SetDefault("Sticks to enemies\nGenerates a localized hailstorm\n'Do not insert in flare gun'"); + Tooltip.SetDefault("Sticks to enemies\n" + + "Generates a localized hailstorm\n'Do not insert in flare gun'"); } + public override void SafeSetDefaults() { item.damage = 32; @@ -34,6 +36,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.shootSpeed = 22f; item.maxStack = 999; item.consumable = true; + item.GetGlobalItem(mod).rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/GelDart.cs b/Items/CalamityCustomThrowingDamage/GelDart.cs index 97e5b15c2b..a658cea929 100644 --- a/Items/CalamityCustomThrowingDamage/GelDart.cs +++ b/Items/CalamityCustomThrowingDamage/GelDart.cs @@ -35,7 +35,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("GelDartProjectile"); item.shootSpeed = 12f; - } + item.GetGlobalItem(mod).rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/IceStar.cs b/Items/CalamityCustomThrowingDamage/IceStar.cs index 653852fe09..4f6356dc83 100644 --- a/Items/CalamityCustomThrowingDamage/IceStar.cs +++ b/Items/CalamityCustomThrowingDamage/IceStar.cs @@ -37,7 +37,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("IceStarProjectile"); item.shootSpeed = 14f; - } + item.GetGlobalItem(mod).rogue = true; + } public override void AddRecipes() { diff --git a/Items/Weapons/Cryogen/Icebreaker.cs b/Items/CalamityCustomThrowingDamage/Icebreaker.cs similarity index 84% rename from Items/Weapons/Cryogen/Icebreaker.cs rename to Items/CalamityCustomThrowingDamage/Icebreaker.cs index 2fa0d7cecd..b5769a57c5 100644 --- a/Items/Weapons/Cryogen/Icebreaker.cs +++ b/Items/CalamityCustomThrowingDamage/Icebreaker.cs @@ -1,47 +1,48 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons.Cryogen -{ - public class Icebreaker : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Icebreaker"); - } - - public override void SetDefaults() - { - item.width = 60; - item.damage = 57; - item.noMelee = true; - item.noUseGraphic = true; - item.useAnimation = 14; - item.useStyle = 1; - item.useTime = 14; - item.knockBack = 6.75f; - item.UseSound = SoundID.Item1; - item.melee = true; - item.height = 60; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.shoot = mod.ProjectileType("Icebreaker"); - item.shootSpeed = 16f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CryoBar", 11); - recipe.AddTile(TileID.IceMachine); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage +{ + public class Icebreaker : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Icebreaker"); + } + + public override void SafeSetDefaults() + { + item.width = 60; + item.damage = 57; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 14; + item.useStyle = 1; + item.useTime = 14; + item.knockBack = 6.75f; + item.UseSound = SoundID.Item1; + item.melee = true; + item.height = 60; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("Icebreaker"); + item.shootSpeed = 16f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CryoBar", 11); + recipe.AddTile(TileID.IceMachine); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Cryogen/Icebreaker.png b/Items/CalamityCustomThrowingDamage/Icebreaker.png similarity index 100% rename from Items/Weapons/Cryogen/Icebreaker.png rename to Items/CalamityCustomThrowingDamage/Icebreaker.png diff --git a/Items/CalamityCustomThrowingDamage/IchorSpear.cs b/Items/CalamityCustomThrowingDamage/IchorSpear.cs index f41baafb8d..9ebe90d2d4 100644 --- a/Items/CalamityCustomThrowingDamage/IchorSpear.cs +++ b/Items/CalamityCustomThrowingDamage/IchorSpear.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("IchorSpear"); item.shootSpeed = 20f; + item.GetGlobalItem(mod).rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/Lionfish.cs b/Items/CalamityCustomThrowingDamage/Lionfish.cs index 32984dc3d7..98ee242c0d 100644 --- a/Items/CalamityCustomThrowingDamage/Lionfish.cs +++ b/Items/CalamityCustomThrowingDamage/Lionfish.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 3; item.shoot = mod.ProjectileType("Lionfish"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/MangroveChakram.cs b/Items/CalamityCustomThrowingDamage/MangroveChakram.cs index 92357e4599..ea51cfa9f9 100644 --- a/Items/CalamityCustomThrowingDamage/MangroveChakram.cs +++ b/Items/CalamityCustomThrowingDamage/MangroveChakram.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 7; item.shoot = mod.ProjectileType("MangroveChakramProjectile"); item.shootSpeed = 15.5f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/Weapons/MeteorFist.cs b/Items/CalamityCustomThrowingDamage/MeteorFist.cs similarity index 83% rename from Items/Weapons/MeteorFist.cs rename to Items/CalamityCustomThrowingDamage/MeteorFist.cs index 62f54f0999..2e51e52483 100644 --- a/Items/Weapons/MeteorFist.cs +++ b/Items/CalamityCustomThrowingDamage/MeteorFist.cs @@ -1,49 +1,49 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class MeteorFist : ModItem - { +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage +{ + public class MeteorFist : CalamityDamageItem + { public override void SetStaticDefaults() { DisplayName.SetDefault("Meteor Fist"); } - public override void SetDefaults() - { - item.width = 22; - item.damage = 15; - item.melee = true; - item.noMelee = true; - item.useTurn = true; - item.noUseGraphic = true; - item.useAnimation = 30; - item.useStyle = 5; - item.useTime = 30; - item.knockBack = 5.75f; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.height = 28; - item.value = Item.buyPrice(0, 2, 0, 0); - item.rare = 2; - item.shoot = mod.ProjectileType("MeteorFist"); - item.shootSpeed = 10f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.MeteoriteBar, 10); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} + public override void SafeSetDefaults() + { + item.width = 22; + item.damage = 15; + item.noMelee = true; + item.useTurn = true; + item.noUseGraphic = true; + item.useAnimation = 30; + item.useStyle = 5; + item.useTime = 30; + item.knockBack = 5.75f; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.height = 28; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("MeteorFist"); + item.shootSpeed = 10f; + item.GetGlobalItem(mod).rogue = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MeteoriteBar, 10); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/MeteorFist.png b/Items/CalamityCustomThrowingDamage/MeteorFist.png similarity index 100% rename from Items/Weapons/MeteorFist.png rename to Items/CalamityCustomThrowingDamage/MeteorFist.png diff --git a/Items/CalamityCustomThrowingDamage/Mycoroot.cs b/Items/CalamityCustomThrowingDamage/Mycoroot.cs index 3d573a25f5..1be358bbdb 100644 --- a/Items/CalamityCustomThrowingDamage/Mycoroot.cs +++ b/Items/CalamityCustomThrowingDamage/Mycoroot.cs @@ -34,6 +34,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.value = Item.buyPrice(0, 2, 0, 0); item.shoot = mod.ProjectileType("Mycoroot"); item.shootSpeed = 20f; + item.GetGlobalItem(mod).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) diff --git a/Items/CalamityCustomThrowingDamage/MythrilKnife.cs b/Items/CalamityCustomThrowingDamage/MythrilKnife.cs index e7844dd355..7e01ee8ed0 100644 --- a/Items/CalamityCustomThrowingDamage/MythrilKnife.cs +++ b/Items/CalamityCustomThrowingDamage/MythrilKnife.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("MythrilKnifeProjectile"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs b/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs index 140a953df0..19e8cf48ee 100644 --- a/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs +++ b/Items/CalamityCustomThrowingDamage/OrichalcumSpikedGemstone.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("OrichalcumSpikedGemstoneProjectile"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs b/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs index 9ddc9882a6..a65f21183d 100644 --- a/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs +++ b/Items/CalamityCustomThrowingDamage/PalladiumJavelin.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("PalladiumJavelinProjectile"); item.shootSpeed = 16f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.cs b/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.cs new file mode 100644 index 0000000000..a169506821 --- /dev/null +++ b/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage.Patreon +{ + public class Plaguenade : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguenade"); + Tooltip.SetDefault("Releases a swarm of angry plague bees"); + } + + public override void SafeSetDefaults() + { + item.width = 20; + item.damage = 60; + item.noMelee = true; + item.noUseGraphic = true; + item.consumable = true; + item.useAnimation = 12; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 1.5f; + item.maxStack = 999; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 28; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("Plaguenade"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Beenade, 15); + recipe.AddIngredient(null, "PlagueCellCluster", 3); + recipe.AddIngredient(ItemID.Obsidian, 2); + recipe.AddIngredient(ItemID.Stinger); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this, 30); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.png b/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.png new file mode 100644 index 0000000000..16cbb3dd4e Binary files /dev/null and b/Items/CalamityCustomThrowingDamage/Patreon/Plaguenade.png differ diff --git a/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs b/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs index 0273eae73f..1ad1da36ab 100644 --- a/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs +++ b/Items/CalamityCustomThrowingDamage/Pwnagehammer.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 6; item.shoot = mod.ProjectileType("Pwnagehammer"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/RadiantStar.cs b/Items/CalamityCustomThrowingDamage/RadiantStar.cs index 818905c630..2c089c26cb 100644 --- a/Items/CalamityCustomThrowingDamage/RadiantStar.cs +++ b/Items/CalamityCustomThrowingDamage/RadiantStar.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.shootSpeed = 20f; item.GetGlobalItem(mod).rogue = true; } - + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.cs b/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.cs new file mode 100644 index 0000000000..4a56d61284 --- /dev/null +++ b/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage.RareVariants +{ + public class DuneHopper : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dune Hopper"); + } + + public override void SafeSetDefaults() + { + item.width = 44; + item.damage = 18; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 22; + item.useStyle = 1; + item.useTime = 22; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 44; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.shoot = mod.ProjectileType("ScourgeoftheDesert2"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.png b/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.png new file mode 100644 index 0000000000..772cd356aa Binary files /dev/null and b/Items/CalamityCustomThrowingDamage/RareVariants/DuneHopper.png differ diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.cs b/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.cs new file mode 100644 index 0000000000..2d3a5f54f7 --- /dev/null +++ b/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage.RareVariants +{ + public class Quasar : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Quasar"); + Tooltip.SetDefault("Succ"); + } + + public override void SafeSetDefaults() + { + item.width = 52; + item.damage = 50; + item.crit += 8; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 12; + item.useStyle = 1; + item.useTime = 12; + item.knockBack = 0f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 48; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; + item.shoot = mod.ProjectileType("RadiantStar"); + item.shootSpeed = 20f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 1f, 0f); + return false; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.png b/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.png new file mode 100644 index 0000000000..e29e6807b2 Binary files /dev/null and b/Items/CalamityCustomThrowingDamage/RareVariants/Quasar.png differ diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.cs b/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.cs new file mode 100644 index 0000000000..ee23eea187 --- /dev/null +++ b/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage.RareVariants +{ + public class SpearofDestiny : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear of Destiny"); + } + + public override void SafeSetDefaults() + { + item.width = 52; + item.damage = 25; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 2f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 52; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.shoot = mod.ProjectileType("IchorSpear"); + item.shootSpeed = 20f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + 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) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(3); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, (i == 1 ? type : mod.ProjectileType("IchorSpear2")), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.png b/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.png new file mode 100644 index 0000000000..b991524840 Binary files /dev/null and b/Items/CalamityCustomThrowingDamage/RareVariants/SpearofDestiny.png differ diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.cs b/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.cs new file mode 100644 index 0000000000..ce2cebe7d8 --- /dev/null +++ b/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage.RareVariants +{ + public class TheReaper : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Reaper"); + Tooltip.SetDefault("Slice 'n dice"); + } + + public override void SafeSetDefaults() + { + item.width = 80; + item.damage = 350; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 22; + item.useTime = 22; + item.useStyle = 1; + item.knockBack = 4f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 64; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("Valediction2"); + item.shootSpeed = 20f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.png b/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.png new file mode 100644 index 0000000000..1c3cefaf35 Binary files /dev/null and b/Items/CalamityCustomThrowingDamage/RareVariants/TheReaper.png differ diff --git a/Items/CalamityCustomThrowingDamage/RotBall.cs b/Items/CalamityCustomThrowingDamage/RotBall.cs index 783fd1e2d1..7eb9aada0c 100644 --- a/Items/CalamityCustomThrowingDamage/RotBall.cs +++ b/Items/CalamityCustomThrowingDamage/RotBall.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 3; item.shoot = mod.ProjectileType("RotBallProjectile"); item.shootSpeed = 16f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/RoyalKnives.png b/Items/CalamityCustomThrowingDamage/RoyalKnives.png index f54945e13e..4d31893202 100644 Binary files a/Items/CalamityCustomThrowingDamage/RoyalKnives.png and b/Items/CalamityCustomThrowingDamage/RoyalKnives.png differ diff --git a/Items/CalamityCustomThrowingDamage/SandDollar.cs b/Items/CalamityCustomThrowingDamage/SandDollar.cs index eba731e2f2..11f4d6b736 100644 --- a/Items/CalamityCustomThrowingDamage/SandDollar.cs +++ b/Items/CalamityCustomThrowingDamage/SandDollar.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 2; item.shoot = mod.ProjectileType("SandDollarProj"); item.shootSpeed = 14f; + item.GetGlobalItem(mod).rogue = true; } public override bool CanUseItem(Player player) diff --git a/Items/CalamityCustomThrowingDamage/ScarletDevil.cs b/Items/CalamityCustomThrowingDamage/ScarletDevil.cs new file mode 100644 index 0000000000..f525426025 --- /dev/null +++ b/Items/CalamityCustomThrowingDamage/ScarletDevil.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.CalamityCustomThrowingDamage +{ + public class ScarletDevil : CalamityDamageItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scarlet Devil"); + Tooltip.SetDefault("Throws an ultra high velocity spear, which creates more projectiles that home in\n"+ + "The spear creates a Scarlet Blast upon hitting an enemy\n"+ + "Stealth strikes grant you lifesteal\n"+ + "'Divine Spear \"Spear the Gungnir\"'"); + } + + public override void SafeSetDefaults() + { + item.width = 94; + item.height = 94; + item.damage = 40000; + item.crit += 20; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 60; + item.useStyle = 1; + item.useTime = 60; + item.knockBack = 8f; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.value = Item.buyPrice(5, 0, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("ScarletDevilProjectile"); + item.shootSpeed = 30f; + item.GetGlobalItem(mod).rogue = true; + item.GetGlobalItem(mod).postMoonLordRarity = 16; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "ProfanedTrident"); + recipe.AddIngredient(null, "BloodstoneCore", 15); + recipe.AddIngredient(ItemID.SoulofNight, 15); + recipe.AddIngredient(null, "ShadowspecBar", 5); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/CalamityCustomThrowingDamage/ScarletDevil.png b/Items/CalamityCustomThrowingDamage/ScarletDevil.png new file mode 100644 index 0000000000..c5ca6bbc04 Binary files /dev/null and b/Items/CalamityCustomThrowingDamage/ScarletDevil.png differ diff --git a/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs b/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs index 537e57b9e4..05e3994d80 100644 --- a/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs +++ b/Items/CalamityCustomThrowingDamage/ScourgeoftheDesert.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SetStaticDefaults() { DisplayName.SetDefault("Scourge of the Desert"); - Tooltip.SetDefault("Revengeance drop"); } public override void SafeSetDefaults() @@ -34,6 +33,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 2; item.shoot = mod.ProjectileType("ScourgeoftheDesert"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs b/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs index 255bad9736..906416c62b 100644 --- a/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs +++ b/Items/CalamityCustomThrowingDamage/SeafoamBomb.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.Bomb, 25); recipe.AddIngredient(null, "SeaPrism", 10); - recipe.AddTile(TileID.Anvils); + recipe.AddTile(TileID.Anvils); recipe.SetResult(this); recipe.AddRecipe(); } diff --git a/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs b/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs index b06f578ee5..e0045d4549 100644 --- a/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs +++ b/Items/CalamityCustomThrowingDamage/SeashellBoomerang.cs @@ -32,7 +32,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 2; item.shoot = mod.ProjectileType("SeashellBoomerangProjectile"); item.shootSpeed = 11.5f; - } + item.GetGlobalItem(mod).rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/SnapClam.cs b/Items/CalamityCustomThrowingDamage/SnapClam.cs index f205dda4a1..669f28fd88 100644 --- a/Items/CalamityCustomThrowingDamage/SnapClam.cs +++ b/Items/CalamityCustomThrowingDamage/SnapClam.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 2; item.shoot = mod.ProjectileType("SnapClamProj"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs b/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs index 3861283e44..1ac97b3af4 100644 --- a/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs +++ b/Items/CalamityCustomThrowingDamage/SpearofPaleolith.cs @@ -34,7 +34,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 5; item.shoot = mod.ProjectileType("SpearofPaleolith"); item.shootSpeed = 35f; - } + item.GetGlobalItem(mod).rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/SpearofPaleolith.png b/Items/CalamityCustomThrowingDamage/SpearofPaleolith.png index 45ec221cf2..ead032cb98 100644 Binary files a/Items/CalamityCustomThrowingDamage/SpearofPaleolith.png and b/Items/CalamityCustomThrowingDamage/SpearofPaleolith.png differ diff --git a/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs b/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs index 1d5ef541eb..990a7b021b 100644 --- a/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs +++ b/Items/CalamityCustomThrowingDamage/TitaniumShuriken.cs @@ -36,7 +36,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 4; item.shoot = mod.ProjectileType("TitaniumShurikenProjectile"); item.shootSpeed = 16f; - } + item.GetGlobalItem(mod).rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/ToothBall.cs b/Items/CalamityCustomThrowingDamage/ToothBall.cs index 9c2a2a594b..810ebb3c01 100644 --- a/Items/CalamityCustomThrowingDamage/ToothBall.cs +++ b/Items/CalamityCustomThrowingDamage/ToothBall.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 3; item.shoot = mod.ProjectileType("ToothBallProjectile"); item.shootSpeed = 16f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs b/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs index 47b849ea31..994aa80fd2 100644 --- a/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs +++ b/Items/CalamityCustomThrowingDamage/TruePaladinsHammer.cs @@ -33,7 +33,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 8; item.shoot = mod.ProjectileType("OPHammer"); item.shootSpeed = 14f; - } + item.GetGlobalItem(mod).rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityCustomThrowingDamage/UrchinStinger.cs b/Items/CalamityCustomThrowingDamage/UrchinStinger.cs index 94cdf62a89..ca64eb7d3f 100644 --- a/Items/CalamityCustomThrowingDamage/UrchinStinger.cs +++ b/Items/CalamityCustomThrowingDamage/UrchinStinger.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 1; item.shoot = mod.ProjectileType("UrchinStinger"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } } } diff --git a/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs b/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs index 3c81fc04fe..02c611c5e3 100644 --- a/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs +++ b/Items/CalamityCustomThrowingDamage/WulfrumKnife.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 1; item.shoot = mod.ProjectileType("WulfrumKnife"); item.shootSpeed = 12f; + item.GetGlobalItem(mod).rogue = true; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs b/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs index af4593cd9e..03cc98c790 100644 --- a/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs +++ b/Items/CalamityCustomThrowingDamage/XerocPitchfork.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage public override void SafeSetDefaults() { item.width = 48; - item.damage = 180; + item.damage = 360; item.noMelee = true; item.consumable = true; item.noUseGraphic = true; @@ -35,7 +35,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage item.rare = 9; item.shoot = mod.ProjectileType("XerocPitchforkProjectile"); item.shootSpeed = 16f; - } + item.GetGlobalItem(mod).rogue = true; + } public override void AddRecipes() { diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index ecfc4d74ce..d90f977370 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -118,6 +118,32 @@ namespace CalamityMod.Items speedX *= CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity; speedY *= CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingVelocity; } + if (player.GetModPlayer(mod).luxorsGift) + { + if (player.whoAmI == Main.myPlayer) + { + if (item.melee) + { + Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, mod.ProjectileType("LuxorsGiftMelee"), (int)((double)damage * 0.6), 0f, player.whoAmI, 0f, 0f); + } + else if (rogue) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LuxorsGiftRogue"), (int)((double)damage * 0.8), 0f, player.whoAmI, 0f, 0f); + } + else if (item.ranged) + { + Projectile.NewProjectile(position.X, position.Y, speedX * 1.5f, speedY * 1.5f, mod.ProjectileType("LuxorsGiftRanged"), (int)((double)damage * 0.5), 0f, player.whoAmI, 0f, 0f); + } + else if (item.magic) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("LuxorsGiftMagic"), (int)((double)damage * 0.8), 0f, player.whoAmI, 0f, 0f); + } + else if (item.summon && player.ownedProjectileCounts[mod.ProjectileType("LuxorsGiftSummon")] < 1) + { + Projectile.NewProjectile(position.X, position.Y, 0f, 0f, mod.ProjectileType("LuxorsGiftSummon"), damage, 0f, player.whoAmI, 0f, 0f); + } + } + } if (player.GetModPlayer(mod).eArtifact && item.ranged && !rogue) { speedX *= 1.25f; @@ -300,12 +326,21 @@ namespace CalamityMod.Items { if (item.type == ItemID.Heart || item.type == ItemID.CandyApple || item.type == ItemID.CandyCane) { + bool boostedHeart = player.GetModPlayer(mod).photosynthesis; if (NPC.AnyNPCs(mod.NPCType("SupremeCalamitas"))) { - player.statLife -= 10; + player.statLife -= (boostedHeart ? 5 : 10); if (Main.myPlayer == player.whoAmI) { - player.HealEffect(-10, true); + player.HealEffect((boostedHeart ? -5 : -10), true); + } + } + if (boostedHeart) + { + player.statLife += 5; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(5, true); } } } @@ -362,9 +397,12 @@ namespace CalamityMod.Items { return !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); } - if (item.type == ItemID.RodofDiscord && modPlayer.scarfCooldown) + if (item.type == ItemID.RodofDiscord) { - player.AddBuff(BuffID.ChaosState, 720); + if (modPlayer.scarfCooldown) + { + player.AddBuff(BuffID.ChaosState, 720); + } } return true; } @@ -421,6 +459,9 @@ namespace CalamityMod.Items case 21: //Patreon tt2.overrideColor = new Color(139, 0, 0); break; + case 22: //Rare Variants + tt2.overrideColor = new Color(255, 140, 0); + break; default: break; } @@ -1431,6 +1472,10 @@ namespace CalamityMod.Items if (revenge) player.QuickSpawnItem(mod.ItemType("CounterScarf")); break; + case ItemID.SkeletronBossBag: + if (Main.rand.Next(40) == 0) + player.QuickSpawnItem(mod.ItemType("ClothiersWrath")); + break; case ItemID.WallOfFleshBossBag: player.QuickSpawnItem(mod.ItemType("MLGRune")); if (Main.rand.Next(3) == 0) @@ -1513,13 +1558,12 @@ namespace CalamityMod.Items } } break; - case ItemID.CultistBossBag: - player.QuickSpawnItem(mod.ItemType("MeldBlob"), Main.rand.Next(25, 31)); - if (Main.rand.Next(3) == 0) - player.QuickSpawnItem(mod.ItemType("StardustStaff")); - break; case ItemID.MoonLordBossBag: player.QuickSpawnItem(mod.ItemType("MLGRune2")); + if (Main.rand.Next(40) == 0) + player.QuickSpawnItem(mod.ItemType("Infinity")); + if (Main.rand.Next(40) == 0) + player.QuickSpawnItem(mod.ItemType("GrandDad")); break; } if (revenge) @@ -1857,6 +1901,38 @@ namespace CalamityMod.Items } #endregion + #region WingChanges + public override void HorizontalWingSpeeds(Item item, Player player, ref float speed, ref float acceleration) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + float flightSpeedMult = 1f + + (modPlayer.soaring ? 0.1f : 0f) + + (modPlayer.holyWrath ? 0.05f : 0f) + + (modPlayer.profanedRage ? 0.05f : 0f) + + (modPlayer.draconicSurge ? 0.15f : 0f); + + speed *= flightSpeedMult; + + float flightAccMult = 1f + + (modPlayer.draconicSurge ? 0.15f : 0f); + + acceleration *= flightAccMult; + } + #endregion + + #region GrabChanges + public override void GrabRange(Item item, Player player, ref int grabRange) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + int itemGrabRangeBoost = 0 + + (modPlayer.wallOfFleshLore ? 19 : 0) + + (modPlayer.planteraLore ? 38 : 0) + + (modPlayer.polterghastLore ? 57 : 0); + + grabRange += itemGrabRangeBoost; + } + #endregion + /// /// Dust helper to spawn dust for an item. Allows you to specify where on the item to spawn the dust, essentially. (ONLY WORKS FOR SWINGING WEAPONS?) /// diff --git a/Items/CosmicPlushie.cs b/Items/CosmicPlushie.cs index 00636ee773..5eb6b4ff81 100644 --- a/Items/CosmicPlushie.cs +++ b/Items/CosmicPlushie.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Items item.value = Item.sellPrice(0, 7, 0, 0); item.shoot = mod.ProjectileType("ChibiiDoggo"); item.buffType = mod.BuffType("ChibiiBuff"); + item.rare = 10; item.UseSound = new Terraria.Audio.LegacySoundStyle(SoundID.Meowmere, 5); item.GetGlobalItem(mod).postMoonLordRarity = 14; } diff --git a/Items/Cryogen/CryogenBag.cs b/Items/Cryogen/CryogenBag.cs index 1fe387e736..d5fc85073f 100644 --- a/Items/Cryogen/CryogenBag.cs +++ b/Items/Cryogen/CryogenBag.cs @@ -82,6 +82,10 @@ namespace CalamityMod.Items.Cryogen { player.QuickSpawnItem(mod.ItemType("SnowstormStaff")); } + if (Main.rand.Next(40) == 0) + { + player.QuickSpawnItem(mod.ItemType("Regenator")); + } if (Main.rand.Next(5) == 0) { player.QuickSpawnItem(ItemID.FrozenKey); diff --git a/Items/DarksunFragment.cs b/Items/DarksunFragment.cs index 729623620b..a730792010 100644 --- a/Items/DarksunFragment.cs +++ b/Items/DarksunFragment.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Items item.width = 20; item.height = 20; item.maxStack = 999; + item.rare = 10; item.value = Item.buyPrice(0, 8, 0, 0); item.GetGlobalItem(mod).postMoonLordRarity = 15; } diff --git a/Items/DesertScourge/DesertScourgeBag.cs b/Items/DesertScourge/DesertScourgeBag.cs index cae8924c92..293ef50c65 100644 --- a/Items/DesertScourge/DesertScourgeBag.cs +++ b/Items/DesertScourge/DesertScourgeBag.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Items.DesertScourge { if (CalamityWorld.revenge) { - player.QuickSpawnItem(mod.ItemType("ScourgeoftheDesert")); if (Main.rand.Next(20) == 0) { switch (Main.rand.Next(3)) @@ -125,6 +124,21 @@ namespace CalamityMod.Items.DesertScourge { player.QuickSpawnItem(mod.ItemType("AeroStone")); } + if (Main.rand.Next(3) == 0) + { + if (Main.rand.Next(12) == 0) + { + player.QuickSpawnItem(mod.ItemType("DuneHopper")); + } + else + { + player.QuickSpawnItem(mod.ItemType("ScourgeoftheDesert")); + } + } + if (Main.rand.Next(40) == 0) + { + player.QuickSpawnItem(mod.ItemType("DeepDiver")); + } if (NPC.downedBoss3) { if (Main.rand.Next(20) == 0) diff --git a/Items/DesertScourge/VictoryShard.png b/Items/DesertScourge/VictoryShard.png index 2494cc399a..89e5ea4508 100644 Binary files a/Items/DesertScourge/VictoryShard.png and b/Items/DesertScourge/VictoryShard.png differ diff --git a/Items/DifficultyItems/MLGRune.png b/Items/DifficultyItems/MLGRune.png index 573076e80f..e1cf416b98 100644 Binary files a/Items/DifficultyItems/MLGRune.png and b/Items/DifficultyItems/MLGRune.png differ diff --git a/Items/DimensionalSoulArtifact.cs b/Items/DimensionalSoulArtifact.cs index 763b3bcf28..4c754401d8 100644 --- a/Items/DimensionalSoulArtifact.cs +++ b/Items/DimensionalSoulArtifact.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Items item.height = 28; item.value = Item.buyPrice(1, 50, 0, 0); item.accessory = true; + item.rare = 10; item.GetGlobalItem(mod).postMoonLordRarity = 16; } diff --git a/Items/Dragonfruit.cs b/Items/Dragonfruit.cs index 715fbad68a..f4ea23e0cd 100644 --- a/Items/Dragonfruit.cs +++ b/Items/Dragonfruit.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Items item.useStyle = 4; item.UseSound = SoundID.Item4; item.consumable = true; + item.rare = 10; item.GetGlobalItem(mod).postMoonLordRarity = 14; } diff --git a/Items/Ectoheart.cs b/Items/Ectoheart.cs index dd3ba30093..9d445b6c03 100644 --- a/Items/Ectoheart.cs +++ b/Items/Ectoheart.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items DisplayName.SetDefault("Ectoheart"); Tooltip.SetDefault("Permanently makes Adrenaline Mode take 5 less seconds to charge\n" + "Revengeance drop"); - Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 4)); + Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(5, 5)); } public override void SetDefaults() @@ -29,6 +29,7 @@ namespace CalamityMod.Items item.useStyle = 4; item.UseSound = SoundID.Item122; item.consumable = true; + item.rare = 10; item.GetGlobalItem(mod).postMoonLordRarity = 13; } diff --git a/Items/Ectoheart.png b/Items/Ectoheart.png index e501a96419..74fada8880 100644 Binary files a/Items/Ectoheart.png and b/Items/Ectoheart.png differ diff --git a/Items/EldritchSoulArtifact.cs b/Items/EldritchSoulArtifact.cs index f2ba4d7bce..b6b6c2de48 100644 --- a/Items/EldritchSoulArtifact.cs +++ b/Items/EldritchSoulArtifact.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Items item.height = 28; item.value = Item.buyPrice(1, 50, 0, 0); item.accessory = true; + item.rare = 10; item.GetGlobalItem(mod).postMoonLordRarity = 16; } diff --git a/Items/EndothermicEnergy.cs b/Items/EndothermicEnergy.cs index 6fb6396154..47bb6de727 100644 --- a/Items/EndothermicEnergy.cs +++ b/Items/EndothermicEnergy.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Items item.width = 20; item.height = 20; item.maxStack = 999; + item.rare = 10; item.value = Item.buyPrice(0, 7, 50, 0); item.GetGlobalItem(mod).postMoonLordRarity = 14; } diff --git a/Items/Fabsol.cs b/Items/Fabsol.cs index 59c596458f..c6ebb59dc3 100644 --- a/Items/Fabsol.cs +++ b/Items/Fabsol.cs @@ -20,6 +20,7 @@ namespace CalamityMod.Items item.useTime = 20; item.useAnimation = 20; item.useStyle = 1; + item.rare = 10; item.value = Item.buyPrice(3, 0, 0, 0); item.expert = true; item.UseSound = SoundID.Item3; diff --git a/Items/FabsolStuff/RedWine.cs b/Items/FabsolStuff/RedWine.cs index b01e87013c..b17a978fb5 100644 --- a/Items/FabsolStuff/RedWine.cs +++ b/Items/FabsolStuff/RedWine.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Items.FabsolStuff DisplayName.SetDefault("Red Wine"); Tooltip.SetDefault(@"Reduces life regen by 1 Too dry for my taste -15 second duration Restores 200 life"); } diff --git a/Items/FoxDrive.cs b/Items/FoxDrive.cs index 6eeb029873..063219a536 100644 --- a/Items/FoxDrive.cs +++ b/Items/FoxDrive.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Items item.CloneDefaults(ItemID.ZephyrFish); item.shoot = mod.ProjectileType("Fox"); item.buffType = mod.BuffType("Fox"); - item.expert = true; + item.rare = 10; + item.expert = true; } public override void UseStyle(Player player) diff --git a/Items/GodlySoulArtifact.cs b/Items/GodlySoulArtifact.cs index a62b793423..9f3ec3eef1 100644 --- a/Items/GodlySoulArtifact.cs +++ b/Items/GodlySoulArtifact.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Items item.height = 28; item.value = Item.buyPrice(1, 50, 0, 0); item.accessory = true; + item.rare = 10; item.GetGlobalItem(mod).postMoonLordRarity = 16; } diff --git a/Items/Levi.cs b/Items/Levi.cs index a5a2a075d3..870af9b89a 100644 --- a/Items/Levi.cs +++ b/Items/Levi.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Items item.CloneDefaults(ItemID.ZephyrFish); item.shoot = mod.ProjectileType("Levi"); item.buffType = mod.BuffType("Levi"); - } + item.rare = 10; + } public override void UseStyle(Player player) { diff --git a/Items/Leviathan/LeviathanAmbergris.cs b/Items/Leviathan/LeviathanAmbergris.cs index 2ac69dc57f..b35554f606 100644 --- a/Items/Leviathan/LeviathanAmbergris.cs +++ b/Items/Leviathan/LeviathanAmbergris.cs @@ -59,8 +59,7 @@ namespace CalamityMod.Items.Leviathan { if (player.whoAmI == Main.myPlayer) { - int projectile1 = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("PoisonousSeawater"), 50, 5f, player.whoAmI, 0f, 0f); - Main.projectile[projectile1].timeLeft = 10; + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("PoisonousSeawater"), 50, 5f, player.whoAmI, 0f, 0f); } } int seaCounter = 0; diff --git a/Items/Knowledge.cs b/Items/LoreItems/Knowledge.cs similarity index 64% rename from Items/Knowledge.cs rename to Items/LoreItems/Knowledge.cs index 979e99ef1a..626f5dcb1c 100644 --- a/Items/Knowledge.cs +++ b/Items/LoreItems/Knowledge.cs @@ -1,36 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Desert Scourge"); - Tooltip.SetDefault("The great sea worm appears to have survived the extreme heat and has even adapted to it.\n" + - "What used to be a majestic beast swimming through the water has now become a dried-up and\n" + - "gluttonous husk on a constant and voracious search for its next meal."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 1; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Desert Scourge"); + Tooltip.SetDefault("The great sea worm appears to have survived the extreme heat and has even adapted to it.\n" + + "What used to be a majestic beast swimming through the water has now become a dried-up and\n" + + "gluttonous husk, constantly on a voracious search for its next meal.\n" + + "Place in your inventory for an increase to defense while in the desert or sunken sea."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 1; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + if (player.ZoneDesert || player.GetModPlayer(mod).ZoneSunkenSea) + { + player.GetModPlayer(mod).desertScourgeLore = true; + } + } + } } \ No newline at end of file diff --git a/Items/Knowledge.png b/Items/LoreItems/Knowledge.png similarity index 100% rename from Items/Knowledge.png rename to Items/LoreItems/Knowledge.png diff --git a/Items/Knowledge10.cs b/Items/LoreItems/Knowledge10.cs similarity index 92% rename from Items/Knowledge10.cs rename to Items/LoreItems/Knowledge10.cs index 7d0c8ab644..e668f8fa53 100644 --- a/Items/Knowledge10.cs +++ b/Items/LoreItems/Knowledge10.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge10 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Ocean"); - Tooltip.SetDefault("Take care to not disturb the deep waters of this world.\n" + - "You may awaken something more terrifying than death itself."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 7; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge10 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Ocean"); + Tooltip.SetDefault("Take care to not disturb the deep waters of this world.\n" + + "You may awaken something more terrifying than death itself."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 7; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge10.png b/Items/LoreItems/Knowledge10.png similarity index 100% rename from Items/Knowledge10.png rename to Items/LoreItems/Knowledge10.png diff --git a/Items/LoreItems/Knowledge11.cs b/Items/LoreItems/Knowledge11.cs new file mode 100644 index 0000000000..8cef28cd1d --- /dev/null +++ b/Items/LoreItems/Knowledge11.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge11 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Brain of Cthulhu"); + Tooltip.SetDefault("An eye and now a brain.\n" + + "Most likely another abomination spawned from this inchoate mass of flesh.\n" + + "Allows you to teleport similar to the Rod of Discord while in the crimson. Place in your hotbar to use it."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.autoReuse = false; + item.useStyle = 1; + item.useAnimation = 20; + item.useTime = 20; + item.UseSound = SoundID.Item8; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return player.ZoneCrimson; + } + + public override bool UseItem(Player player) + { + if (Main.myPlayer == player.whoAmI && player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + Vector2 vector31; + vector31.X = (float)Main.mouseX + Main.screenPosition.X; + if (player.gravDir == 1f) + { + vector31.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)player.height; + } + else + { + vector31.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY; + } + vector31.X -= (float)(player.width / 2); + if (vector31.X > 50f && vector31.X < (float)(Main.maxTilesX * 16 - 50) && vector31.Y > 50f && vector31.Y < (float)(Main.maxTilesY * 16 - 50)) + { + int num275 = (int)(vector31.X / 16f); + int num276 = (int)(vector31.Y / 16f); + if ((Main.tile[num275, num276].wall != 87 || (double)num276 <= Main.worldSurface || NPC.downedPlantBoss) && !Collision.SolidCollision(vector31, player.width, player.height)) + { + player.Teleport(vector31, 1, 0); + NetMessage.SendData(65, -1, -1, null, 0, (float)player.whoAmI, vector31.X, vector31.Y, 1, 0, 0); + if (player.chaosState) + { + player.statLife -= player.statLifeMax2 / 7; + PlayerDeathReason damageSource = PlayerDeathReason.ByOther(13); + if (Main.rand.Next(2) == 0) + { + damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15); + } + if (player.statLife <= 0) + { + player.KillMe(damageSource, 1.0, 0, false); + } + player.lifeRegenCount = 0; + player.lifeRegenTime = 0; + } + player.AddBuff(BuffID.ChaosState, 360, true); + } + } + } + return true; + } + } +} \ No newline at end of file diff --git a/Items/Knowledge11.png b/Items/LoreItems/Knowledge11.png similarity index 100% rename from Items/Knowledge11.png rename to Items/LoreItems/Knowledge11.png diff --git a/Items/Knowledge12.cs b/Items/LoreItems/Knowledge12.cs similarity index 66% rename from Items/Knowledge12.cs rename to Items/LoreItems/Knowledge12.cs index f23cb04eeb..00ff91c0a4 100644 --- a/Items/Knowledge12.cs +++ b/Items/LoreItems/Knowledge12.cs @@ -1,35 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge12 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Eater of Worlds"); - Tooltip.SetDefault("Perhaps it was just a giant worm infected by the microbe, given centuries to feed and grow its festering body.\n" + - "Seems likely, given the origins of this place."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge12 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Eater of Worlds"); + Tooltip.SetDefault("Perhaps it was just a giant worm infected by the microbe, given centuries to feed and grow its festering body.\n" + + "Seems likely, given the origins of this place.\n" + + "Deadly microbes spawn around you while this is placed in your inventory."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.eaterOfWorldsLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge12.png b/Items/LoreItems/Knowledge12.png similarity index 100% rename from Items/Knowledge12.png rename to Items/LoreItems/Knowledge12.png diff --git a/Items/Knowledge13.cs b/Items/LoreItems/Knowledge13.cs similarity index 60% rename from Items/Knowledge13.cs rename to Items/LoreItems/Knowledge13.cs index b8de7336c7..8fc509edce 100644 --- a/Items/Knowledge13.cs +++ b/Items/LoreItems/Knowledge13.cs @@ -1,35 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge13 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Perforators and their Hive"); - Tooltip.SetDefault("An abomination of comingled flesh, bone, and organ; infested primarily by blood-slurping worms.\n" + - "The chunks left over from the brain must have been absorbed by the crimson and reconstituted into that thing."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 3; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge13 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Perforators and their Hive"); + Tooltip.SetDefault("An abomination of comingled flesh, bone, and organ, infested primarily by blood-slurping worms.\n" + + "The chunks left over from the brain must have been absorbed by the crimson and reconstituted into it.\n" + + "Place in your inventory for all of your projectiles to inflict ichor when in the crimson."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 3; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + if (player.ZoneCrimson) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.perforatorLore = true; + } + } + } } \ No newline at end of file diff --git a/Items/Knowledge13.png b/Items/LoreItems/Knowledge13.png similarity index 100% rename from Items/Knowledge13.png rename to Items/LoreItems/Knowledge13.png diff --git a/Items/Knowledge14.cs b/Items/LoreItems/Knowledge14.cs similarity index 59% rename from Items/Knowledge14.cs rename to Items/LoreItems/Knowledge14.cs index 15f4c14e7a..5b0f6259b0 100644 --- a/Items/Knowledge14.cs +++ b/Items/LoreItems/Knowledge14.cs @@ -1,35 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge14 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Hive Mind"); - Tooltip.SetDefault("A hive of clustered microbial-infected flesh.\n" + - "Sadly I do not believe killing it will lessen the corruption here."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 3; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge14 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Hive Mind"); + Tooltip.SetDefault("A hive of clustered microbial-infected flesh.\n" + + "I do not believe killing it will lessen the corruption here.\n" + + "Place in your inventory for all of your projectiles to inflict cursed flames when in the corruption."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 3; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + if (player.ZoneCorrupt) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.hiveMindLore = true; + } + } + } } \ No newline at end of file diff --git a/Items/Knowledge14.png b/Items/LoreItems/Knowledge14.png similarity index 100% rename from Items/Knowledge14.png rename to Items/LoreItems/Knowledge14.png diff --git a/Items/Knowledge15.cs b/Items/LoreItems/Knowledge15.cs similarity index 63% rename from Items/Knowledge15.cs rename to Items/LoreItems/Knowledge15.cs index ea2cc3d39b..d60c57d2d9 100644 --- a/Items/Knowledge15.cs +++ b/Items/LoreItems/Knowledge15.cs @@ -1,35 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge15 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Slime God"); - Tooltip.SetDefault("It is a travesty, one of the most threatening biological terrors ever born.\n" + - "If this creature were allowed to combine every slime on the planet then it would be nearly unstoppable."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 4; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge15 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Slime God"); + Tooltip.SetDefault("It is a travesty, one of the most threatening biological terrors ever created.\n" + + "If this creature were allowed to combine every slime on the planet it would become nearly unstoppable.\n" + + "Place in your inventory to become slimed and able to slide around on tiles quickly."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 4; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + player.slippy2 = true; + if (Main.myPlayer == player.whoAmI) + { + player.AddBuff(BuffID.Slimed, 2); + } + } + } } \ No newline at end of file diff --git a/Items/Knowledge15.png b/Items/LoreItems/Knowledge15.png similarity index 100% rename from Items/Knowledge15.png rename to Items/LoreItems/Knowledge15.png diff --git a/Items/Knowledge16.cs b/Items/LoreItems/Knowledge16.cs similarity index 63% rename from Items/Knowledge16.cs rename to Items/LoreItems/Knowledge16.cs index 81d58214ac..3e28de5a05 100644 --- a/Items/Knowledge16.cs +++ b/Items/LoreItems/Knowledge16.cs @@ -1,35 +1,41 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge16 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Queen Bee"); - Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations.\n" + - "...given the ability to control them."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 3; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge16 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Queen Bee"); + Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations...given the ability to control them.\n" + + "Place in your inventory to make small bees and weak hornets friendly."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 3; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.queenBeeLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge16.png b/Items/LoreItems/Knowledge16.png similarity index 100% rename from Items/Knowledge16.png rename to Items/LoreItems/Knowledge16.png diff --git a/Items/Knowledge17.cs b/Items/LoreItems/Knowledge17.cs similarity index 64% rename from Items/Knowledge17.cs rename to Items/LoreItems/Knowledge17.cs index ba6bfcc9e0..91322d07bb 100644 --- a/Items/Knowledge17.cs +++ b/Items/LoreItems/Knowledge17.cs @@ -1,35 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge17 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Skeletron"); - Tooltip.SetDefault("The curse is said to only affect the elderly.\n" + - "After they are afflicted they become an immortal vessel for an ancient demon of the underworld."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 3; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge17 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skeletron"); + Tooltip.SetDefault("The curse is said to only affect the elderly.\n" + + "After they are afflicted they become an immortal vessel for an ancient demon of the underworld.\n" + + "Place in your inventory to gain increased defense and damage while in the dungeon."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 3; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + if (player.ZoneDungeon) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.skeletronLore = true; + } + } + } } \ No newline at end of file diff --git a/Items/Knowledge17.png b/Items/LoreItems/Knowledge17.png similarity index 100% rename from Items/Knowledge17.png rename to Items/LoreItems/Knowledge17.png diff --git a/Items/Knowledge18.cs b/Items/LoreItems/Knowledge18.cs similarity index 65% rename from Items/Knowledge18.cs rename to Items/LoreItems/Knowledge18.cs index c45d7c5d6f..e5323202d5 100644 --- a/Items/Knowledge18.cs +++ b/Items/LoreItems/Knowledge18.cs @@ -1,36 +1,43 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge18 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wall of Flesh"); - Tooltip.SetDefault("I see the deed is done.\n" + - "The unholy amalgamation of flesh and hatred has been defeated.\n" + - "Prepare to face the true terrors that lurk in the light and dark parts of this world."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 4; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge18 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wall of Flesh"); + Tooltip.SetDefault("I see the deed is done.\n" + + "The unholy amalgamation of flesh and hatred has been defeated.\n" + + "Prepare to face the terrors that lurk in the light and dark parts of this world.\n" + + "Place in your inventory to gain increased item grab range."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 4; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.wallOfFleshLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge18.png b/Items/LoreItems/Knowledge18.png similarity index 100% rename from Items/Knowledge18.png rename to Items/LoreItems/Knowledge18.png diff --git a/Items/Knowledge19.cs b/Items/LoreItems/Knowledge19.cs similarity index 71% rename from Items/Knowledge19.cs rename to Items/LoreItems/Knowledge19.cs index 4704bd7131..88fd7f88da 100644 --- a/Items/Knowledge19.cs +++ b/Items/LoreItems/Knowledge19.cs @@ -1,35 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge19 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Cryogen"); - Tooltip.SetDefault("You managed to bring down what dozens of sorcerers long ago could not.\n" + - "I am unsure if it has grown weaker over the decades of imprisonment."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge19 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryogen"); + Tooltip.SetDefault("You managed to bring down what dozens of sorcerers long ago could not.\n" + + "I am unsure if it has grown weaker over the decades of imprisonment.\n" + + "Place in your inventory to gain a frost dash that freezes enemies."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.dashMod = 6; + } + } } \ No newline at end of file diff --git a/Items/Knowledge19.png b/Items/LoreItems/Knowledge19.png similarity index 100% rename from Items/Knowledge19.png rename to Items/LoreItems/Knowledge19.png diff --git a/Items/Knowledge2.cs b/Items/LoreItems/Knowledge2.cs similarity index 59% rename from Items/Knowledge2.cs rename to Items/LoreItems/Knowledge2.cs index c1265af4d2..6e48a84c20 100644 --- a/Items/Knowledge2.cs +++ b/Items/LoreItems/Knowledge2.cs @@ -1,35 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge2 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Duke Fishron"); - Tooltip.SetDefault("The mutant terror of the sea was once the trusted companion of an old king who tamed it using its favorite treat.\n" + - "Long ago, the creature flew in desperation from the raging bloody inferno consuming its home, ultimately finding its way to the ocean."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 8; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge2 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Duke Fishron"); + Tooltip.SetDefault("The mutant terror of the sea was once the trusted companion of an old king; he tamed it using its favorite treat.\n" + + "Long ago, the creature flew in desperation from the raging bloody inferno consuming its home, ultimately finding its way to the ocean.\n" + + "Place in your inventory for an increase to all damage, crit, and movement speed while submerged in liquid."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 8; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.dukeFishronLore = true; + } + } + } } \ No newline at end of file diff --git a/Items/Knowledge2.png b/Items/LoreItems/Knowledge2.png similarity index 100% rename from Items/Knowledge2.png rename to Items/LoreItems/Knowledge2.png diff --git a/Items/Knowledge20.cs b/Items/LoreItems/Knowledge20.cs similarity index 92% rename from Items/Knowledge20.cs rename to Items/LoreItems/Knowledge20.cs index 1c82b86461..990b6f7f35 100644 --- a/Items/Knowledge20.cs +++ b/Items/LoreItems/Knowledge20.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge20 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Mechanical Bosses"); - Tooltip.SetDefault("I see you have awakened Draedon's old toys.\n" + - "Once useful tools turned into savage beasts when their AIs went rogue, a mistake that Draedon failed to rectify in time."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge20 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Mechanical Bosses"); + Tooltip.SetDefault("I see you have awakened Draedon's old toys.\n" + + "Once useful tools turned into savage beasts when their AIs went rogue, a mistake that Draedon failed to rectify in time."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge20.png b/Items/LoreItems/Knowledge20.png similarity index 100% rename from Items/Knowledge20.png rename to Items/LoreItems/Knowledge20.png diff --git a/Items/Knowledge21.cs b/Items/LoreItems/Knowledge21.cs similarity index 56% rename from Items/Knowledge21.cs rename to Items/LoreItems/Knowledge21.cs index 0590484d96..6ec601ce6e 100644 --- a/Items/Knowledge21.cs +++ b/Items/LoreItems/Knowledge21.cs @@ -1,35 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge21 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Destroyer"); - Tooltip.SetDefault("A machine brought to life by the mighty souls of warriors and built to excavate massive tunnels in planets to gather resources.\n" + - "Could have proven useful if he didn't have an obsession with turning everything into a tool of destruction."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge21 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Destroyer"); + Tooltip.SetDefault("A machine brought to life by the mighty souls of warriors, and built to excavate massive tunnels in planets to gather resources.\n" + + "Could have proven useful if Draedon didn't have an obsession with turning everything into a tool of destruction.\n" + + "Place in your inventory to gain a boost to your pick speed."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.destroyerLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge21.png b/Items/LoreItems/Knowledge21.png similarity index 100% rename from Items/Knowledge21.png rename to Items/LoreItems/Knowledge21.png diff --git a/Items/Knowledge22.cs b/Items/LoreItems/Knowledge22.cs similarity index 75% rename from Items/Knowledge22.cs rename to Items/LoreItems/Knowledge22.cs index c95adb526b..cfcf3f3169 100644 --- a/Items/Knowledge22.cs +++ b/Items/LoreItems/Knowledge22.cs @@ -1,35 +1,44 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge22 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Twins"); - Tooltip.SetDefault("The bio-mechanical watchers of the night, originally created as security using the souls extracted from human eyes.\n" + - "These creatures did not belong in this world, it's best to be rid of them."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge22 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Twins"); + Tooltip.SetDefault("The bio-mechanical watchers of the night, originally created as security using the souls extracted from human eyes.\n" + + "These creatures did not belong in this world, it's best to be rid of them.\n" + + "Place in your inventory to gain invisibility at night."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + if (!Main.dayTime) + { + player.invis = true; + } + } + } } \ No newline at end of file diff --git a/Items/Knowledge22.png b/Items/LoreItems/Knowledge22.png similarity index 100% rename from Items/Knowledge22.png rename to Items/LoreItems/Knowledge22.png diff --git a/Items/Knowledge23.cs b/Items/LoreItems/Knowledge23.cs similarity index 64% rename from Items/Knowledge23.cs rename to Items/LoreItems/Knowledge23.cs index 5db926aed6..235f3f864f 100644 --- a/Items/Knowledge23.cs +++ b/Items/LoreItems/Knowledge23.cs @@ -1,35 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge23 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Skeletron Prime"); - Tooltip.SetDefault("What a silly and pointless contraption for something created with the essence of pure terror.\n" + - "Draedon obviously took several liberties with his design of this thing...I am not impressed. Better off destroyed."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge23 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skeletron Prime"); + Tooltip.SetDefault("What a silly and pointless contraption for something created with the essence of pure terror.\n" + + "Draedon obviously took several liberties with its design...I am not impressed.\n" + + "Place in your inventory to gain a boost to your armor penetration."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.skeletronPrimeLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge23.png b/Items/LoreItems/Knowledge23.png similarity index 100% rename from Items/Knowledge23.png rename to Items/LoreItems/Knowledge23.png diff --git a/Items/Knowledge24.cs b/Items/LoreItems/Knowledge24.cs similarity index 67% rename from Items/Knowledge24.cs rename to Items/LoreItems/Knowledge24.cs index 2b3a8af4d6..9a7c4bb5ae 100644 --- a/Items/Knowledge24.cs +++ b/Items/LoreItems/Knowledge24.cs @@ -1,35 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge24 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas Doppelganger"); - Tooltip.SetDefault("You are indeed stronger than I thought.\n" + - "Though the bloody inferno still lingers, observing your progress..."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge24 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas Doppelganger"); + Tooltip.SetDefault("You are indeed stronger than I thought.\n" + + "Though the bloody inferno still lingers, observing your progress.\n" + + "Place in your inventory to gain a boost to your minion slots but at the cost of reduced max health."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.calamitasLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge24.png b/Items/LoreItems/Knowledge24.png similarity index 100% rename from Items/Knowledge24.png rename to Items/LoreItems/Knowledge24.png diff --git a/Items/Knowledge25.cs b/Items/LoreItems/Knowledge25.cs similarity index 57% rename from Items/Knowledge25.cs rename to Items/LoreItems/Knowledge25.cs index a920486e75..29f8bde6ee 100644 --- a/Items/Knowledge25.cs +++ b/Items/LoreItems/Knowledge25.cs @@ -1,36 +1,43 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge25 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Plantera"); - Tooltip.SetDefault("Well done, you killed a plant.\n" + - "However, this plant was used as a vessel to house the spirits of those unfortunate enough to find their way down here.\n" + - "I wish you luck in dealing with the fallout."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 6; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge25 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plantera"); + Tooltip.SetDefault("Well done, you killed a plant.\n" + + "It was used as a vessel to house the spirits of those unfortunate enough to find their way down here.\n" + + "I wish you luck in dealing with the fallout.\n" + + "Place in your inventory to gain a boost to your item grab range."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 6; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.planteraLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge25.png b/Items/LoreItems/Knowledge25.png similarity index 100% rename from Items/Knowledge25.png rename to Items/LoreItems/Knowledge25.png diff --git a/Items/Knowledge26.cs b/Items/LoreItems/Knowledge26.cs similarity index 69% rename from Items/Knowledge26.cs rename to Items/LoreItems/Knowledge26.cs index 598e238427..a38e8a12b8 100644 --- a/Items/Knowledge26.cs +++ b/Items/LoreItems/Knowledge26.cs @@ -1,35 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge26 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Elemental"); - Tooltip.SetDefault("The most powerful of the elementals, bent on exacting revenge upon the bloody inferno that demolished her home.\n" + - "Finally put to rest, she will suffer no longer from the grief caused by the deaths of her people."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge26 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Elemental"); + Tooltip.SetDefault("The most powerful of the elementals, bent on exacting revenge upon the bloody inferno that demolished her home.\n" + + "Finally put to rest, she will suffer no longer from the grief caused by the deaths of her people.\n" + + "Place in your inventory to improve the inferno potion effect."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.brimstoneElementalLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge26.png b/Items/LoreItems/Knowledge26.png similarity index 100% rename from Items/Knowledge26.png rename to Items/LoreItems/Knowledge26.png diff --git a/Items/Knowledge27.cs b/Items/LoreItems/Knowledge27.cs similarity index 65% rename from Items/Knowledge27.cs rename to Items/LoreItems/Knowledge27.cs index c76585b4d0..2825e7e90a 100644 --- a/Items/Knowledge27.cs +++ b/Items/LoreItems/Knowledge27.cs @@ -1,35 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge27 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Aquatic Scourge"); - Tooltip.SetDefault("A horror born of pollution and insatiable hunger; based on size alone this was merely a juvenile.\n" + - "These Scourge creatures are the largest aquatic predators and very rarely do they frequent such shallow waters."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge27 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Aquatic Scourge"); + Tooltip.SetDefault("A horror born of pollution and insatiable hunger; based on size alone this was merely a juvenile.\n" + + "These scourge creatures are the largest aquatic predators and very rarely do they frequent such shallow waters.\n" + + "Place in your inventory to gain immunity to the sulphurous waters and increase the stat gains from the Well Fed buff."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.aquaticScourgeLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge27.png b/Items/LoreItems/Knowledge27.png similarity index 100% rename from Items/Knowledge27.png rename to Items/LoreItems/Knowledge27.png diff --git a/Items/Knowledge28.cs b/Items/LoreItems/Knowledge28.cs similarity index 64% rename from Items/Knowledge28.cs rename to Items/LoreItems/Knowledge28.cs index 8499997f15..7bc80f687a 100644 --- a/Items/Knowledge28.cs +++ b/Items/LoreItems/Knowledge28.cs @@ -1,35 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge28 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Leviathan and Siren"); - Tooltip.SetDefault("An odd pair of creatures; one seeking companionship and the other seeking sustenance.\n" + - "Perhaps two genetic misfits outcast from their homes that found comfort in assisting one another."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 7; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge28 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Leviathan and Siren"); + Tooltip.SetDefault("An odd pair of creatures; one seeking companionship and the other seeking sustenance.\n" + + "Perhaps two genetic misfits outcast from their homes that found comfort in assisting one another.\n" + + "Place in your inventory to gain increased max health while wearing the siren heart and treasure detect while wearing the strange orb."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 7; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.leviathanAndSirenLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge28.png b/Items/LoreItems/Knowledge28.png similarity index 100% rename from Items/Knowledge28.png rename to Items/LoreItems/Knowledge28.png diff --git a/Items/Knowledge29.cs b/Items/LoreItems/Knowledge29.cs similarity index 52% rename from Items/Knowledge29.cs rename to Items/LoreItems/Knowledge29.cs index c861d4d670..cc5e1eff31 100644 --- a/Items/Knowledge29.cs +++ b/Items/LoreItems/Knowledge29.cs @@ -1,35 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge29 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Deus"); - Tooltip.SetDefault("God of the stars and spreader of the astral infection.\n" + - "Though it was not the progenitor of the infection, that scaleless beast is still out there, devouring celestial bodies by the dozens."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 7; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge29 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Deus"); + Tooltip.SetDefault("God of the stars and largest vessel for the Astral Infection.\n" + + "Though struck down from its place among the stars its remnants have gathered strength, aiming to take its rightful place in the cosmos once more.\n" + + "Place in your inventory to gain increased movement speed in space."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 7; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.astrumDeusLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge29.png b/Items/LoreItems/Knowledge29.png similarity index 100% rename from Items/Knowledge29.png rename to Items/LoreItems/Knowledge29.png diff --git a/Items/Knowledge3.cs b/Items/LoreItems/Knowledge3.cs similarity index 76% rename from Items/Knowledge3.cs rename to Items/LoreItems/Knowledge3.cs index 3373a5ff52..36e495a410 100644 --- a/Items/Knowledge3.cs +++ b/Items/LoreItems/Knowledge3.cs @@ -1,35 +1,41 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge3 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Eye of Cthulhu"); - Tooltip.SetDefault("That eye...how peculiar.\n" + - "I sensed it watching you more intensely as you grew stronger."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 1; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge3 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Eye of Cthulhu"); + Tooltip.SetDefault("That eye...how peculiar.\n" + + "I sensed it watching you more intensely as you grew stronger.\n" + + "Place in your inventory for night vision at all times."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 1; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + player.nightVision = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge3.png b/Items/LoreItems/Knowledge3.png similarity index 100% rename from Items/Knowledge3.png rename to Items/LoreItems/Knowledge3.png diff --git a/Items/Knowledge30.cs b/Items/LoreItems/Knowledge30.cs similarity index 70% rename from Items/Knowledge30.cs rename to Items/LoreItems/Knowledge30.cs index ca831ff967..90722a6c3b 100644 --- a/Items/Knowledge30.cs +++ b/Items/LoreItems/Knowledge30.cs @@ -1,35 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge30 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Astrum Aureus"); - Tooltip.SetDefault("A titanic cyborg infected by a star-borne disease expelled from the belly of an ancient god.\n" + - "The destruction of this creature will not prevent the spread of the disease."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 7; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge30 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astrum Aureus"); + Tooltip.SetDefault("A titanic cyborg infected by a star-borne disease expelled from the belly of an ancient god.\n" + + "The destruction of this creature will not prevent the spread of the disease.\n" + + "Place in your inventory to gain increased jump speed in space."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 7; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.astrumAureusLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge30.png b/Items/LoreItems/Knowledge30.png similarity index 100% rename from Items/Knowledge30.png rename to Items/LoreItems/Knowledge30.png diff --git a/Items/LoreItems/Knowledge31.cs b/Items/LoreItems/Knowledge31.cs new file mode 100644 index 0000000000..85b2829658 --- /dev/null +++ b/Items/LoreItems/Knowledge31.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge31 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Golem"); + Tooltip.SetDefault("A primitive construct.\n" + + "I admire the lihzahrd race for their ingenuity, though finding faith in such a flawed idol would invariably lead to their downfall.\n" + + "Place in your inventory to gain increased defense while standing still."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 8; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.golemLore = true; + } + } +} \ No newline at end of file diff --git a/Items/Knowledge31.png b/Items/LoreItems/Knowledge31.png similarity index 100% rename from Items/Knowledge31.png rename to Items/LoreItems/Knowledge31.png diff --git a/Items/Knowledge32.cs b/Items/LoreItems/Knowledge32.cs similarity index 66% rename from Items/Knowledge32.cs rename to Items/LoreItems/Knowledge32.cs index 727a471577..12ee6fbee4 100644 --- a/Items/Knowledge32.cs +++ b/Items/LoreItems/Knowledge32.cs @@ -1,35 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge32 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Plaguebringer Goliath"); - Tooltip.SetDefault("A horrific amalgam of steel, flesh, and infection; capable of destroying an entire civilization in just one onslaught.\n" + - "Its plague nuke barrage can leave an entire area uninhabitable for months. A shame that it came to this but the plague must be containted."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 8; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge32 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Plaguebringer Goliath"); + Tooltip.SetDefault("A horrific amalgam of steel, flesh, and infection, capable of destroying an entire civilization in just one onslaught.\n" + + "Its plague nuke barrage can leave an entire area uninhabitable for months. A shame that it came to this but the plague must be contained.\n" + + "Place in your inventory to gain increased wing flight time but at the cost of reduced life regen."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 8; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.plaguebringerGoliathLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge32.png b/Items/LoreItems/Knowledge32.png similarity index 100% rename from Items/Knowledge32.png rename to Items/LoreItems/Knowledge32.png diff --git a/Items/Knowledge33.cs b/Items/LoreItems/Knowledge33.cs similarity index 50% rename from Items/Knowledge33.cs rename to Items/LoreItems/Knowledge33.cs index 369618f53f..6557db22b0 100644 --- a/Items/Knowledge33.cs +++ b/Items/LoreItems/Knowledge33.cs @@ -1,35 +1,42 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge33 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Ravager"); - Tooltip.SetDefault("One of many flesh golems crafted through forbidden necromancy to counter my unstoppable forces.\n" + - "Its creators were slaughtered by it moments after its conception. It's for the best that is has been destroyed."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 8; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge33 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ravager"); + Tooltip.SetDefault("The flesh golem constructed using twisted necromancy during the time of my conquest to counter my unstoppable forces.\n" + + "Its creators were slaughtered by it moments after its conception. It is for the best that it has been destroyed.\n" + + "Place in your inventory to gain an increase to all damage but reduced wing flight time."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 8; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.ravagerLore = true; + } + } } \ No newline at end of file diff --git a/Items/Knowledge33.png b/Items/LoreItems/Knowledge33.png similarity index 100% rename from Items/Knowledge33.png rename to Items/LoreItems/Knowledge33.png diff --git a/Items/Knowledge34.cs b/Items/LoreItems/Knowledge34.cs similarity index 92% rename from Items/Knowledge34.cs rename to Items/LoreItems/Knowledge34.cs index c758db88c1..ac75d29f2d 100644 --- a/Items/Knowledge34.cs +++ b/Items/LoreItems/Knowledge34.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge34 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Red Moon"); - Tooltip.SetDefault("We long ago feared the light of the red moon.\n" + - "Many went mad, others died, but a scant few became blessed with a wealth of cosmic understanding."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 9; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge34 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Red Moon"); + Tooltip.SetDefault("We long ago feared the light of the red moon.\n" + + "Many went mad, others died, but a scant few became blessed with a wealth of cosmic understanding."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 9; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge34.png b/Items/LoreItems/Knowledge34.png similarity index 100% rename from Items/Knowledge34.png rename to Items/LoreItems/Knowledge34.png diff --git a/Items/LoreItems/Knowledge35.cs b/Items/LoreItems/Knowledge35.cs new file mode 100644 index 0000000000..646080c447 --- /dev/null +++ b/Items/LoreItems/Knowledge35.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge35 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sulphur Sea"); + Tooltip.SetDefault("I remember the serene waves and the clear breeze.\n" + + "The bitterness of my youth has long since subsided, but it is far too late. I must never repeat a mistake like this again."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Knowledge4.png b/Items/LoreItems/Knowledge35.png similarity index 100% rename from Items/Knowledge4.png rename to Items/LoreItems/Knowledge35.png diff --git a/Items/Knowledge31.cs b/Items/LoreItems/Knowledge36.cs similarity index 60% rename from Items/Knowledge31.cs rename to Items/LoreItems/Knowledge36.cs index c1e2024d8a..0f1b9716c8 100644 --- a/Items/Knowledge31.cs +++ b/Items/LoreItems/Knowledge36.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge31 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Golem"); - Tooltip.SetDefault("To think my people once worshipped this thing as a god...\n" + - "We have come far since those ancient times."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 8; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge36 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Biome"); + Tooltip.SetDefault("This twisted dreamscape, surrounded by unnatural pillars under a dark and hazy sky.\n" + + "Natural law has been upturned. What will you make of it?"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 7; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge5.png b/Items/LoreItems/Knowledge36.png similarity index 100% rename from Items/Knowledge5.png rename to Items/LoreItems/Knowledge36.png diff --git a/Items/LoreItems/Knowledge37.cs b/Items/LoreItems/Knowledge37.cs new file mode 100644 index 0000000000..6839effa87 --- /dev/null +++ b/Items/LoreItems/Knowledge37.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge37 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moon Lord"); + Tooltip.SetDefault("What a waste.\n" + + "Had it been fully restored it would have been a force to behold, but what you fought was an empty shell.\n" + + "However, that doesn't diminish the immense potential locked within it, released upon its death.\n" + + "Place in your inventory to gain an improved Gravity Globe that gives you an increase to all stats while upside down."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.moonLordLore = true; + } + } +} \ No newline at end of file diff --git a/Items/Knowledge6.png b/Items/LoreItems/Knowledge37.png similarity index 100% rename from Items/Knowledge6.png rename to Items/LoreItems/Knowledge37.png diff --git a/Items/LoreItems/Knowledge38.cs b/Items/LoreItems/Knowledge38.cs new file mode 100644 index 0000000000..fb9e712ea0 --- /dev/null +++ b/Items/LoreItems/Knowledge38.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge38 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Profaned Guardians"); + Tooltip.SetDefault("The ever-rejuvenating guardians of the profaned flame.\n" + + "Much like a phoenix from the ashes their deaths are simply a part of their life cycle.\n" + + "Many times my forces have had to destroy these beings in search of the Profaned Goddess."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/Knowledge7.png b/Items/LoreItems/Knowledge38.png similarity index 100% rename from Items/Knowledge7.png rename to Items/LoreItems/Knowledge38.png diff --git a/Items/LoreItems/Knowledge39.cs b/Items/LoreItems/Knowledge39.cs new file mode 100644 index 0000000000..1c0a3fbf14 --- /dev/null +++ b/Items/LoreItems/Knowledge39.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge39 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Providence, the Profaned Goddess"); + Tooltip.SetDefault("A core surrounded by stone and flame, a simple origin and a simple goal.\n" + + "What would have become of us had she not been defeated is a frightening concept to consider.\n" + + "Place in your inventory to imbue all projectiles with profaned flames, causing them to inflict extra damage."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.providenceLore = true; + } + } +} \ No newline at end of file diff --git a/Items/Knowledge8.png b/Items/LoreItems/Knowledge39.png similarity index 100% rename from Items/Knowledge8.png rename to Items/LoreItems/Knowledge39.png diff --git a/Items/Knowledge4.cs b/Items/LoreItems/Knowledge4.cs similarity index 68% rename from Items/Knowledge4.cs rename to Items/LoreItems/Knowledge4.cs index 2d206c24d1..4b92d41c5b 100644 --- a/Items/Knowledge4.cs +++ b/Items/LoreItems/Knowledge4.cs @@ -1,36 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge4 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Lunatic Cultist"); - Tooltip.SetDefault("The gifted one that terminated my grand summoning so long ago with his uncanny powers over the arcane.\n" + - "Someone I once held in such contempt for his actions is now...deceased, his sealing ritual undone...prepare for the end.\n" + - "Your impending doom approaches..."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 9; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge4 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lunatic Cultist"); + Tooltip.SetDefault("The gifted one that terminated my grand summoning so long ago with his uncanny powers over the arcane.\n" + + "Someone I once held in such contempt for his actions is now...deceased, his sealing ritual undone...prepare for the end.\n" + + "Your impending doom approaches...\n" + + "Place in your inventory for an increase to all stats during the lunar event."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 9; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + if (NPC.LunarApocalypseIsUp) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.lunaticCultistLore = true; + } + } + } } \ No newline at end of file diff --git a/Items/LoreItems/Knowledge4.png b/Items/LoreItems/Knowledge4.png new file mode 100644 index 0000000000..220c10080b Binary files /dev/null and b/Items/LoreItems/Knowledge4.png differ diff --git a/Items/Knowledge11.cs b/Items/LoreItems/Knowledge40.cs similarity index 50% rename from Items/Knowledge11.cs rename to Items/LoreItems/Knowledge40.cs index 75c25507b0..db0a5a424e 100644 --- a/Items/Knowledge11.cs +++ b/Items/LoreItems/Knowledge40.cs @@ -1,35 +1,37 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge11 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Brain of Cthulhu"); - Tooltip.SetDefault("An eye and now a brain.\n" + - "Most likely another abomination spawned from this inchoate mass of flesh."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge40 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Sentinels of the Devourer"); + Tooltip.SetDefault("Signus. The Void. The Weaver.\n" + + "Each represent one of the Devourer’s largest spheres of influence.\n" + + "Dispatching them has most likely invoked its anger and marked you as a target for destruction."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/Knowledge9.png b/Items/LoreItems/Knowledge40.png similarity index 100% rename from Items/Knowledge9.png rename to Items/LoreItems/Knowledge40.png diff --git a/Items/LoreItems/Knowledge41.cs b/Items/LoreItems/Knowledge41.cs new file mode 100644 index 0000000000..49bdac30ce --- /dev/null +++ b/Items/LoreItems/Knowledge41.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge41 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Polterghast"); + Tooltip.SetDefault("A creature born of hatred and anger, formed by countless human souls with all of their energy entirely devoted to consuming others.\n" + + "It seems a waste to have had such a potent source of power ravage mindlessly through these empty halls.\n" + + "Place in your inventory to gain increased item grab range."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.polterghastLore = true; + } + } +} \ No newline at end of file diff --git a/Items/LoreItems/Knowledge41.png b/Items/LoreItems/Knowledge41.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/LoreItems/Knowledge41.png differ diff --git a/Items/LoreItems/Knowledge42.cs b/Items/LoreItems/Knowledge42.cs new file mode 100644 index 0000000000..51b2c52a76 --- /dev/null +++ b/Items/LoreItems/Knowledge42.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge42 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Devourer of Gods"); + Tooltip.SetDefault("This serpent’s power to assimilate the abilities and energy of those it consumed is unique in almost all the known cosmos, save for its lesser brethren.\n" + + "I would have soon had to eliminate it as a threat had it been given more time and creatures to feast upon.\n" + + "Place in your inventory to boost your true melee damage by 50%."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.DoGLore = true; + } + } +} \ No newline at end of file diff --git a/Items/LoreItems/Knowledge42.png b/Items/LoreItems/Knowledge42.png new file mode 100644 index 0000000000..4d7497c375 Binary files /dev/null and b/Items/LoreItems/Knowledge42.png differ diff --git a/Items/LoreItems/Knowledge43.cs b/Items/LoreItems/Knowledge43.cs new file mode 100644 index 0000000000..f39404dcf0 --- /dev/null +++ b/Items/LoreItems/Knowledge43.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge43 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Bumblebirbs"); + Tooltip.SetDefault("A failure of twisted scientific ambition; it appears our faulted arrogance over life has shown once more in the results.\n" + + "Originally intended to be a clone of the Jungle Dragon, these were left to roam about the jungle, attacking anything in their path."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } +} \ No newline at end of file diff --git a/Items/LoreItems/Knowledge43.png b/Items/LoreItems/Knowledge43.png new file mode 100644 index 0000000000..9156472fcf Binary files /dev/null and b/Items/LoreItems/Knowledge43.png differ diff --git a/Items/LoreItems/Knowledge44.cs b/Items/LoreItems/Knowledge44.cs new file mode 100644 index 0000000000..6aacc283b6 --- /dev/null +++ b/Items/LoreItems/Knowledge44.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge44 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Jungle Dragon, Yharon"); + Tooltip.SetDefault("I would not be able to bear a world without my faithful companion by my side.\n" + + "Fortunately, fate will have it so that it is a world I shall never have to see, for better or for worse.\n" + + "Place in your inventory to gain nearly-infinite wing flight time but at the cost of a 25% decrease to all damage."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.GetGlobalItem(mod).postMoonLordRarity = 14; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.yharonLore = true; + } + } +} \ No newline at end of file diff --git a/Items/LoreItems/Knowledge44.png b/Items/LoreItems/Knowledge44.png new file mode 100644 index 0000000000..220c10080b Binary files /dev/null and b/Items/LoreItems/Knowledge44.png differ diff --git a/Items/LoreItems/Knowledge45.cs b/Items/LoreItems/Knowledge45.cs new file mode 100644 index 0000000000..1a677f3685 --- /dev/null +++ b/Items/LoreItems/Knowledge45.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge45 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas"); + Tooltip.SetDefault("The witch unrivaled. Perhaps the only one amongst my cohorts to have ever given me cause for doubt.\n" + + "Now that you have defeated her your destiny is clear.\n" + + "Come now, face me.\n" + + "Place in your inventory."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 10; + item.consumable = false; + item.GetGlobalItem(mod).postMoonLordRarity = 15; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.SCalLore = true; + } + } +} \ No newline at end of file diff --git a/Items/LoreItems/Knowledge45.png b/Items/LoreItems/Knowledge45.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/LoreItems/Knowledge45.png differ diff --git a/Items/Knowledge5.cs b/Items/LoreItems/Knowledge5.cs similarity index 62% rename from Items/Knowledge5.cs rename to Items/LoreItems/Knowledge5.cs index 810ffe25b0..6f5e097695 100644 --- a/Items/Knowledge5.cs +++ b/Items/LoreItems/Knowledge5.cs @@ -1,35 +1,47 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge5 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crabulon"); - Tooltip.SetDefault("A crab and its mushrooms, a love story.\n" + - "It's interesting how creatures can adapt given certain circumstances."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge5 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crabulon"); + Tooltip.SetDefault("A crab and its mushrooms, a love story.\n" + + "It's interesting how creatures can adapt given certain circumstances.\n" + + "Place in your inventory to gain the Mushy buff while underground or in the mushroom biome."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + + public override void UpdateInventory(Player player) + { + if (player.ZoneGlowshroom || player.ZoneDirtLayerHeight || player.ZoneRockLayerHeight) + { + if (Main.myPlayer == player.whoAmI) + { + player.AddBuff(mod.BuffType("Mushy"), 2); + } + } + } + } } \ No newline at end of file diff --git a/Items/LoreItems/Knowledge5.png b/Items/LoreItems/Knowledge5.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/LoreItems/Knowledge5.png differ diff --git a/Items/Knowledge6.cs b/Items/LoreItems/Knowledge6.cs similarity index 92% rename from Items/Knowledge6.cs rename to Items/LoreItems/Knowledge6.cs index ba302a60e7..6761e068ff 100644 --- a/Items/Knowledge6.cs +++ b/Items/LoreItems/Knowledge6.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge6 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Brimstone Crag"); - Tooltip.SetDefault("Ah...this place.\n" + - "The scent of broken promises, pain, and eventual death is heavy in the air..."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 5; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge6 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimstone Crag"); + Tooltip.SetDefault("Ah...this place.\n" + + "The scent of broken promises, pain, and eventual death is heavy in the air..."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 5; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/LoreItems/Knowledge6.png b/Items/LoreItems/Knowledge6.png new file mode 100644 index 0000000000..4d7497c375 Binary files /dev/null and b/Items/LoreItems/Knowledge6.png differ diff --git a/Items/Knowledge7.cs b/Items/LoreItems/Knowledge7.cs similarity index 79% rename from Items/Knowledge7.cs rename to Items/LoreItems/Knowledge7.cs index b97a6d8469..ab83466970 100644 --- a/Items/Knowledge7.cs +++ b/Items/LoreItems/Knowledge7.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge7 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Underworld"); - Tooltip.SetDefault("These obsidian and hellstone towers were once home to thousands of...'people'.\n" + - "Unfortunately for them they were twisted by their inner demons until they were beyond saving."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 4; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge7 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Underworld"); + Tooltip.SetDefault("These obsidian and hellstone towers were once home to thousands of...'people'.\n" + + "Unfortunately for them, they were twisted by their inner demons until they were beyond saving."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 4; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/LoreItems/Knowledge7.png b/Items/LoreItems/Knowledge7.png new file mode 100644 index 0000000000..9156472fcf Binary files /dev/null and b/Items/LoreItems/Knowledge7.png differ diff --git a/Items/Knowledge8.cs b/Items/LoreItems/Knowledge8.cs similarity index 92% rename from Items/Knowledge8.cs rename to Items/LoreItems/Knowledge8.cs index 0a3d5b6614..4641de4482 100644 --- a/Items/Knowledge8.cs +++ b/Items/LoreItems/Knowledge8.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge8 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Crimson"); - Tooltip.SetDefault("This bloody hell, spawned from a formless mass of flesh that fell from the stars eons ago.\n" + - "It is now home to many hideous creatures, spawned from the pumping blood and lurching organs deep within."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge8 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Crimson"); + Tooltip.SetDefault("This bloody hell, spawned from a formless mass of flesh that fell from the stars eons ago.\n" + + "It is now home to many hideous creatures, spawned from the pumping blood and lurching organs deep within."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/LoreItems/Knowledge8.png b/Items/LoreItems/Knowledge8.png new file mode 100644 index 0000000000..220c10080b Binary files /dev/null and b/Items/LoreItems/Knowledge8.png differ diff --git a/Items/Knowledge9.cs b/Items/LoreItems/Knowledge9.cs similarity index 77% rename from Items/Knowledge9.cs rename to Items/LoreItems/Knowledge9.cs index 05de233461..8f9d172957 100644 --- a/Items/Knowledge9.cs +++ b/Items/LoreItems/Knowledge9.cs @@ -1,35 +1,35 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Localization; -using Terraria.ID; -using Terraria.DataStructures; -using Terraria.ModLoader; -using CalamityMod.NPCs; - -namespace CalamityMod.Items -{ - public class Knowledge9 : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("The Corruption"); - Tooltip.SetDefault("Ah, the rotten and forever-deteriorating landscape of infected life, brought upon by a deadly microbe long ago.\n" + - "It is rumored that the microbe was created through experimentation by a long-dead race, predating the Terrarians."); - } - - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.rare = 2; - item.consumable = false; - } - - public override bool CanUseItem(Player player) - { - return false; - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Localization; +using Terraria.ID; +using Terraria.DataStructures; +using Terraria.ModLoader; +using CalamityMod.NPCs; + +namespace CalamityMod.Items.LoreItems +{ + public class Knowledge9 : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Corruption"); + Tooltip.SetDefault("The rotten and forever-deteriorating landscape of infected life, brought upon by a deadly microbe long ago.\n" + + "It is rumored that the microbe was created through experimentation by a long-dead race, predating the Terrarians."); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.rare = 2; + item.consumable = false; + } + + public override bool CanUseItem(Player player) + { + return false; + } + } } \ No newline at end of file diff --git a/Items/LoreItems/Knowledge9.png b/Items/LoreItems/Knowledge9.png new file mode 100644 index 0000000000..2976af7e04 Binary files /dev/null and b/Items/LoreItems/Knowledge9.png differ diff --git a/Items/MLGRune2.cs b/Items/MLGRune2.cs index 6e8a62bcc6..0dad669897 100644 --- a/Items/MLGRune2.cs +++ b/Items/MLGRune2.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items { item.width = 28; item.height = 28; - item.expert = true; + item.rare = 10; item.maxStack = 99; item.useAnimation = 30; item.useTime = 30; @@ -34,7 +34,7 @@ namespace CalamityMod.Items public override bool CanUseItem(Player player) { CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (!Main.expertMode || modPlayer.extraAccessoryML) + if (modPlayer.extraAccessoryML) { return false; } diff --git a/Items/MLGRune2.png b/Items/MLGRune2.png index bf03e60350..532b34cde4 100644 Binary files a/Items/MLGRune2.png and b/Items/MLGRune2.png differ diff --git a/Items/Mounts/AngryDog.cs b/Items/Mounts/AngryDog.cs new file mode 100644 index 0000000000..22447d5909 --- /dev/null +++ b/Items/Mounts/AngryDog.cs @@ -0,0 +1,128 @@ +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; +using System; +using System.Reflection; +using CalamityMod.Items; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Mounts +{ + class AngryDog : ModMountData + { + public override void SetDefaults() + { + mountData.spawnDust = 192; + mountData.spawnDustNoGravity = true; + mountData.buff = mod.BuffType("TundraLeashBuff"); + mountData.heightBoost = 8; + mountData.fallDamage = 0.3f; + mountData.runSpeed = 6.5f; + mountData.flightTimeMax = 0; + mountData.jumpHeight = 16; + mountData.acceleration = 0.21f; + mountData.jumpSpeed = 7f; + mountData.swimSpeed = 3f; + mountData.totalFrames = 13; + int[] array = new int[mountData.totalFrames]; + for (int l = 0; l < array.Length; l++) + { + array[l] = 28; + } + array[1] = 26; + array[4] = 26; + array[7] = 26; + array[10] = 26; + mountData.playerYOffsets = array; + mountData.xOffset = -6; + mountData.bodyFrame = 3; + mountData.yOffset = 0; //done + mountData.playerHeadOffset = 10; + mountData.standingFrameCount = 6; + mountData.standingFrameDelay = 12; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = mountData.standingFrameCount; + mountData.runningFrameDelay = 36; //36 + mountData.runningFrameStart = mountData.standingFrameCount; + mountData.inAirFrameCount = 1; + mountData.inAirFrameDelay = mountData.standingFrameDelay; + mountData.inAirFrameStart = mountData.standingFrameDelay; + mountData.idleFrameCount = mountData.standingFrameCount; //done + mountData.idleFrameDelay = mountData.standingFrameDelay; //done + mountData.idleFrameStart = mountData.standingFrameStart; + mountData.idleFrameLoop = true; + mountData.swimFrameCount = mountData.inAirFrameCount; + mountData.swimFrameDelay = mountData.inAirFrameDelay; + mountData.swimFrameStart = mountData.inAirFrameStart; + if (Main.netMode != 2) + { + mountData.textureWidth = mountData.backTexture.Width; + mountData.textureHeight = mountData.backTexture.Height; + } + } + + public override bool UpdateFrame(Player mountedPlayer, int state, Vector2 velocity) + { + bool speed = Math.Abs(velocity.X) > mountedPlayer.mount.RunSpeed / 2f; + float num10 = (float)Math.Sign(mountedPlayer.velocity.X); + float num11 = 12f; + float num12 = 40f; + if (!speed) + { + mountedPlayer.basiliskCharge = 0f; + } + else + { + mountedPlayer.basiliskCharge = Utils.Clamp(mountedPlayer.basiliskCharge + 0.00555555569f, 0f, 1f); + } + if ((double)mountedPlayer.position.Y > Main.worldSurface * 16.0 + 160.0) + { + Lighting.AddLight(mountedPlayer.Center, 0.2f, 0.25f, 0.25f); + } + if (speed && velocity.Y == 0f) + { + for (int i = 0; i < 2; i++) + { + Dust expr_631 = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, 192, 0f, 0f, 0, default(Color), 1f)]; + expr_631.velocity = new Vector2(velocity.X * 0.15f, Main.rand.NextFloat() * -2f); + expr_631.noLight = true; + expr_631.scale = 0.2f + Main.rand.NextFloat() * 0.8f; + expr_631.fadeIn = 0.5f + Main.rand.NextFloat() * 1f; + expr_631.shader = GameShaders.Armor.GetSecondaryShader(mountedPlayer.cMount, mountedPlayer); + } + if (mountedPlayer.cMount == 0) + { + mountedPlayer.position += new Vector2(num10 * 24f, 0f); + mountedPlayer.FloorVisuals(true); + mountedPlayer.position -= new Vector2(num10 * 24f, 0f); + } + } + if (num10 == (float)mountedPlayer.direction) + { + for (int j = 0; j < (int)(3f * mountedPlayer.basiliskCharge); j++) + { + Dust dust = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, 67, 0f, 0f, 0, default(Color), 1f)]; + Vector2 value2 = mountedPlayer.Center + new Vector2(num10 * num12, num11); + dust.position = mountedPlayer.Center + new Vector2(num10 * (num12 - 2f), num11 - 6f + Main.rand.NextFloat() * 12f); + dust.velocity = (dust.position - value2).SafeNormalize(Vector2.Zero) * (3.5f + Main.rand.NextFloat() * 0.5f); + if (dust.velocity.Y < 0f) + { + Dust expr_808_cp_0_cp_0 = dust; + expr_808_cp_0_cp_0.velocity.Y = expr_808_cp_0_cp_0.velocity.Y * (1f + 2f * Main.rand.NextFloat()); + } + dust.velocity += mountedPlayer.velocity * 0.55f; + dust.velocity *= mountedPlayer.velocity.Length() / mountedPlayer.mount.RunSpeed; + dust.velocity *= mountedPlayer.basiliskCharge; + dust.noGravity = true; + dust.noLight = true; + dust.scale = 0.2f + Main.rand.NextFloat() * 0.8f; + dust.fadeIn = 0.5f + Main.rand.NextFloat() * 1f; + dust.shader = GameShaders.Armor.GetSecondaryShader(mountedPlayer.cMount, mountedPlayer); + } + } + return true; + } + } +} diff --git a/Items/Mounts/AngryDog_Back.png b/Items/Mounts/AngryDog_Back.png new file mode 100644 index 0000000000..bd7dfd15fb Binary files /dev/null and b/Items/Mounts/AngryDog_Back.png differ diff --git a/Items/Mounts/AngryDog_Front.png b/Items/Mounts/AngryDog_Front.png new file mode 100644 index 0000000000..bd7dfd15fb Binary files /dev/null and b/Items/Mounts/AngryDog_Front.png differ diff --git a/Items/Mounts/Crysthamyr.cs b/Items/Mounts/Crysthamyr.cs new file mode 100644 index 0000000000..997a48ded1 --- /dev/null +++ b/Items/Mounts/Crysthamyr.cs @@ -0,0 +1,122 @@ +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Microsoft.Xna.Framework; +using System; +using System.Reflection; +using CalamityMod.Items; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Mounts +{ + class Crysthamyr : ModMountData + { + public override void SetDefaults() + { + mountData.spawnDust = 173; + mountData.spawnDustNoGravity = true; + mountData.buff = mod.BuffType("GazeOfCrysthamyrBuff"); + mountData.heightBoost = 20; + mountData.fallDamage = 0f; + mountData.runSpeed = 5f; + mountData.dashSpeed = 15f; + mountData.flightTimeMax = 750; + mountData.fatigueMax = 0; + mountData.jumpHeight = 12; + mountData.acceleration = 0.6f; + mountData.jumpSpeed = 9f; + mountData.swimSpeed = 6f; + mountData.blockExtraJumps = true; + mountData.totalFrames = 16; + mountData.constantJump = false; + int[] array = new int[mountData.totalFrames]; + for (int l = 0; l < array.Length; l++) + { + array[l] = 30; + } + array[1] = 28; + array[5] = 40; + array[6] = 40; + array[7] = 40; + array[8] = 38; //wing flap sound + array[9] = 40; + array[10] = 40; + array[12] = 28; + array[14] = 28; + mountData.playerYOffsets = array; + mountData.xOffset = -56; + mountData.bodyFrame = 3; + mountData.yOffset = -28; //done + mountData.playerHeadOffset = 26; //30 + mountData.standingFrameCount = 5; + mountData.standingFrameDelay = 12; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = mountData.standingFrameCount; + mountData.runningFrameDelay = 48; //36 + mountData.runningFrameStart = 11; + mountData.flyingFrameCount = 6; + mountData.flyingFrameDelay = mountData.flyingFrameCount; + mountData.flyingFrameStart = mountData.standingFrameCount; + mountData.inAirFrameCount = mountData.flyingFrameCount; + mountData.inAirFrameDelay = mountData.standingFrameDelay; + mountData.inAirFrameStart = mountData.standingFrameCount; + mountData.idleFrameCount = mountData.standingFrameCount; //done + mountData.idleFrameDelay = mountData.standingFrameDelay; //done + mountData.idleFrameStart = mountData.standingFrameStart; + mountData.idleFrameLoop = true; + mountData.swimFrameCount = mountData.inAirFrameCount; + mountData.swimFrameDelay = mountData.inAirFrameDelay; + mountData.swimFrameStart = mountData.inAirFrameStart; + if (Main.netMode != 2) + { + mountData.frontTextureExtra = mod.GetTexture("Items/Mounts/CrysthamyrExtra"); + mountData.textureWidth = mountData.backTexture.Width; + mountData.textureHeight = mountData.backTexture.Height; + } + } + + public override void UpdateEffects(Player player) + { + Lighting.AddLight((int)(player.position.X + (float)(player.width / 2)) / 16, (int)(player.position.Y + (float)(player.height / 2)) / 16, 1f, 0f, 1f); + if (Math.Abs(player.velocity.X) > 6f || Math.Abs(player.velocity.Y) > 6f) + { + int rand = Main.rand.Next(3); + switch (rand) + { + case 0: + rand = 173; + break; + case 1: + rand = 109; + break; + case 2: + rand = 70; + break; + } + Rectangle rect = player.getRect(); + rect.Inflate(50, 20); + if (Math.Abs(player.velocity.X) > 14f || Math.Abs(player.velocity.Y) > 14f) + { + for (int i = 0; i < 2; i++) + { + int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, rand, 0, 0, 0, default(Color)); + Main.dust[dust].noGravity = true; + } + } + int dust2 = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, rand, 0, 0, 0, default(Color)); + Main.dust[dust2].noGravity = true; + } + if (player.velocity.Y != 0f) + { + if (player.mount.PlayerOffset == 38) + { + if (!player.flapSound) + Main.PlaySound(SoundID.Item32, player.position); + player.flapSound = true; + } + else + player.flapSound = false; + } + } + } +} diff --git a/Items/Mounts/CrysthamyrExtra.png b/Items/Mounts/CrysthamyrExtra.png new file mode 100644 index 0000000000..ff38cd925f Binary files /dev/null and b/Items/Mounts/CrysthamyrExtra.png differ diff --git a/Items/Mounts/Crysthamyr_Back.png b/Items/Mounts/Crysthamyr_Back.png new file mode 100644 index 0000000000..905bec1160 Binary files /dev/null and b/Items/Mounts/Crysthamyr_Back.png differ diff --git a/Items/Mounts/Crysthamyr_Front.png b/Items/Mounts/Crysthamyr_Front.png new file mode 100644 index 0000000000..30f9624b36 Binary files /dev/null and b/Items/Mounts/Crysthamyr_Front.png differ diff --git a/Items/Mounts/Fab.cs b/Items/Mounts/Fab.cs index 5c6f4391a2..75dc98128c 100644 --- a/Items/Mounts/Fab.cs +++ b/Items/Mounts/Fab.cs @@ -8,94 +8,111 @@ using CalamityMod.Items.CalamityCustomThrowingDamage; namespace CalamityMod.Items.Mounts { - class Fab : ModMountData - { - public override void SetDefaults() - { - mountData.spawnDust = 234; - mountData.spawnDustNoGravity = true; - mountData.buff = mod.BuffType("Fab"); - mountData.heightBoost = 20; - mountData.fallDamage = 0f; //0.5 - mountData.runSpeed = 18f; //12 - mountData.dashSpeed = 12f; //8 - mountData.flightTimeMax = 50000; - mountData.fatigueMax = 0; - mountData.jumpHeight = 20; - mountData.acceleration = 0.75f; - mountData.jumpSpeed = 15f; //10 - mountData.blockExtraJumps = false; - mountData.totalFrames = 15; - mountData.constantJump = false; - int[] array = new int[mountData.totalFrames]; - for (int l = 0; l < array.Length; l++) - { - array[l] = 30; - } - mountData.playerYOffsets = array; - mountData.xOffset = 0; - mountData.bodyFrame = 3; - mountData.yOffset = 0; //-8 - mountData.playerHeadOffset = 26; //30 - mountData.standingFrameCount = 1; - mountData.standingFrameDelay = 12; - mountData.standingFrameStart = 0; - mountData.runningFrameCount = 8; //7 - mountData.runningFrameDelay = 36; //36 - mountData.runningFrameStart = 1; //9 - mountData.flyingFrameCount = 6; //0 - mountData.flyingFrameDelay = 4; //0 - mountData.flyingFrameStart = 9; //0 - mountData.inAirFrameCount = 1; //1 - mountData.inAirFrameDelay = 12; //12 - mountData.inAirFrameStart = 10; //10 - mountData.idleFrameCount = 5; //4 - mountData.idleFrameDelay = 12; //12 - mountData.idleFrameStart = 0; - mountData.idleFrameLoop = true; - mountData.swimFrameCount = mountData.inAirFrameCount; - mountData.swimFrameDelay = mountData.inAirFrameDelay; - mountData.swimFrameStart = mountData.inAirFrameStart; - if (Main.netMode != 2) - { - mountData.frontTextureExtra = mod.GetTexture("Items/Mounts/FabExtra"); - mountData.textureWidth = mountData.backTexture.Width; - mountData.textureHeight = mountData.backTexture.Height; - } - } + class Fab : ModMountData + { + public override void SetDefaults() + { + mountData.spawnDust = 234; + mountData.spawnDustNoGravity = true; + mountData.buff = mod.BuffType("Fab"); + mountData.heightBoost = 20; + mountData.fallDamage = 0f; //0.5 + mountData.runSpeed = 7f; //12 + mountData.dashSpeed = 21f; //8 + mountData.flightTimeMax = 500; + mountData.fatigueMax = 0; + mountData.jumpHeight = 12; + mountData.acceleration = 0.45f; + mountData.jumpSpeed = 8f; //10 + mountData.swimSpeed = 4f; + mountData.blockExtraJumps = false; + mountData.totalFrames = 15; + mountData.constantJump = false; + int[] array = new int[mountData.totalFrames]; + for (int l = 0; l < array.Length; l++) + { + array[l] = 30; + } + array[1] = 28; + array[3] = 28; + array[5] = 28; + array[7] = 28; + array[12] = 28; + mountData.playerYOffsets = array; + mountData.xOffset = 0; + mountData.bodyFrame = 3; + mountData.yOffset = 0; //-8 + mountData.playerHeadOffset = 26; //30 + mountData.standingFrameCount = 1; + mountData.standingFrameDelay = 12; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = 8; //7 + mountData.runningFrameDelay = 36; //36 + mountData.runningFrameStart = 1; //9 + mountData.flyingFrameCount = 6; //0 + mountData.flyingFrameDelay = 4; //0 + mountData.flyingFrameStart = 9; //0 + mountData.inAirFrameCount = 1; //1 + mountData.inAirFrameDelay = 12; //12 + mountData.inAirFrameStart = 10; //10 + mountData.idleFrameCount = 5; //4 + mountData.idleFrameDelay = 12; //12 + mountData.idleFrameStart = 0; + mountData.idleFrameLoop = true; + mountData.swimFrameCount = mountData.inAirFrameCount; + mountData.swimFrameDelay = mountData.inAirFrameDelay; + mountData.swimFrameStart = mountData.inAirFrameStart; + if (Main.netMode != 2) + { + mountData.frontTextureExtra = mod.GetTexture("Items/Mounts/FabExtra"); + mountData.textureWidth = mountData.backTexture.Width; + mountData.textureHeight = mountData.backTexture.Height; + } + } - public override void UpdateEffects(Player player) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (modPlayer.fabsolVodka) - { - player.meleeDamage += 0.1f; - player.rangedDamage += 0.1f; - player.magicDamage += 0.1f; - player.minionDamage += 0.1f; - CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; - } - if (Math.Abs(player.velocity.X) > 15f) - { - int rand = Main.rand.Next(2); - bool momo = false; - if (rand == 1) - { - momo = true; - } - Color meme; - if (momo) - { - meme = new Color(255, 68, 242); - } - else - { - meme = new Color(25, 105, 255); - } - Rectangle rect = player.getRect(); - int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, 234, 0, 0, 0, meme); - Main.dust[dust].noGravity = true; - } - } - } + public override void UpdateEffects(Player player) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (modPlayer.fabsolVodka) + { + player.meleeDamage += 0.1f; + player.rangedDamage += 0.1f; + player.magicDamage += 0.1f; + player.minionDamage += 0.1f; + CalamityCustomThrowingDamagePlayer.ModPlayer(player).throwingDamage += 0.1f; + } + if (Math.Abs(player.velocity.X) > 12f || Math.Abs(player.velocity.Y) > 12f) + { + int rand = Main.rand.Next(2); + bool momo = false; + if (rand == 1) + { + momo = true; + } + Color meme; + if (momo) + { + meme = new Color(255, 68, 242); + } + else + { + meme = new Color(25, 105, 255); + } + Rectangle rect = player.getRect(); + int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, 234, 0, 0, 0, meme); + Main.dust[dust].noGravity = true; + } + if (player.velocity.Y != 0f) + { + if (player.mount.PlayerOffset == 28) + { + if (!player.flapSound) + Main.PlaySound(SoundID.Item32, player.position); + player.flapSound = true; + } + else + player.flapSound = false; + } + } + } } diff --git a/Items/Mounts/OnyxExcavator.cs b/Items/Mounts/OnyxExcavator.cs new file mode 100644 index 0000000000..0a1de7678b --- /dev/null +++ b/Items/Mounts/OnyxExcavator.cs @@ -0,0 +1,163 @@ +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using Terraria.Graphics.Shaders; +using Terraria.GameContent.Achievements; +using Microsoft.Xna.Framework; +using System; +using CalamityMod.Items; +using CalamityMod.Items.CalamityCustomThrowingDamage; + +namespace CalamityMod.Items.Mounts +{ + class OnyxExcavator : ModMountData + { + public override void SetDefaults() + { + mountData.spawnDust = 109; + mountData.spawnDustNoGravity = true; + mountData.buff = mod.BuffType("OnyxExcavatorBuff"); + mountData.heightBoost = 10; + mountData.fallDamage = 0f; + mountData.runSpeed = 8f; + mountData.flightTimeMax = 0; + mountData.jumpHeight = 5; + mountData.acceleration = 0.2f; + mountData.jumpSpeed = 3f; + mountData.swimSpeed = 0.5f; + mountData.totalFrames = 8; + int[] array = new int[mountData.totalFrames]; + for (int l = 0; l < array.Length; l++) + { + array[l] = 4; + } + array[1] = 2; + array[5] = 2; + mountData.playerYOffsets = array; + mountData.xOffset = 0; //-6 + mountData.bodyFrame = 3; + mountData.yOffset = 0; //done + mountData.playerHeadOffset = 10; + mountData.standingFrameCount = 1; + mountData.standingFrameDelay = 12; + mountData.standingFrameStart = 0; + mountData.runningFrameCount = 8; + mountData.runningFrameDelay = 36; //36 + mountData.runningFrameStart = mountData.standingFrameStart; + mountData.inAirFrameCount = mountData.standingFrameCount; + mountData.inAirFrameDelay = mountData.standingFrameDelay; + mountData.inAirFrameStart = mountData.standingFrameStart; + mountData.idleFrameCount = mountData.standingFrameCount; + mountData.idleFrameDelay = mountData.standingFrameDelay; + mountData.idleFrameStart = mountData.standingFrameStart; + mountData.idleFrameLoop = false; + mountData.swimFrameCount = mountData.inAirFrameCount; + mountData.swimFrameDelay = mountData.inAirFrameDelay; + mountData.swimFrameStart = mountData.inAirFrameStart; + if (Main.netMode != 2) + { + mountData.backTextureExtra = mod.GetTexture("Items/Mounts/OnyxExcavatorExtra"); + mountData.frontTextureExtra = mod.GetTexture("Items/Mounts/OnyxExcavatorExtra2"); + mountData.textureWidth = mountData.backTexture.Width; + mountData.textureHeight = mountData.backTexture.Height; + } + } + + public override bool UpdateFrame(Player mountedPlayer, int state, Vector2 velocity) + { + bool speed = Math.Abs(velocity.X) > mountedPlayer.mount.RunSpeed / 2f; + float num10 = (float)Math.Sign(mountedPlayer.velocity.X); + Lighting.AddLight(mountedPlayer.Center, 0.5f, 0.5f, 0.4f); + if (speed && velocity.Y == 0f) + { + for (int i = 0; i < 2; i++) + { + Dust expr_631 = Main.dust[Dust.NewDust(mountedPlayer.BottomLeft, mountedPlayer.width, 6, 192, 0f, 0f, 0, default(Color), 1f)]; + expr_631.velocity = new Vector2(velocity.X * 0.15f, Main.rand.NextFloat() * -2f); + expr_631.noLight = true; + expr_631.scale = 0.2f + Main.rand.NextFloat() * 0.8f; + expr_631.fadeIn = 0.5f + Main.rand.NextFloat() * 1f; + expr_631.shader = GameShaders.Armor.GetSecondaryShader(mountedPlayer.cMount, mountedPlayer); + } + if (mountedPlayer.cMount == 0) + { + mountedPlayer.position += new Vector2(num10 * 24f, 0f); + mountedPlayer.FloorVisuals(true); + mountedPlayer.position -= new Vector2(num10 * 24f, 0f); + } + } + return true; + } + + public override void UseAbility(Player player, Vector2 mousePosition, bool toggleOn) + { + if (Main.mouseLeft && !player.mouseInterface && !Main.blockMouse) + { + if (Main.myPlayer == player.whoAmI) + { + float num10 = (float)Math.Sign(player.velocity.X); + if ((double)Math.Abs(num10) < 0.1f) + num10 = (player.direction == 1 ? 0.1f : -0.1f); + float num11 = 12f; + float num12 = 40f; + Vector2 value2 = player.Center + new Vector2(num10 * num12, num11); + int num814 = 3; + int num815 = (int)(value2.X / 16f - (float)num814); + int num816 = (int)(value2.X / 16f + (float)num814); + int num817 = (int)(value2.Y / 16f - (float)num814); + int num818 = (int)(value2.Y / 16f + (float)num814); + if (num815 < 0) + { + num815 = 0; + } + if (num816 > Main.maxTilesX) + { + num816 = Main.maxTilesX; + } + if (num817 < 0) + { + num817 = 0; + } + if (num818 > Main.maxTilesY) + { + num818 = Main.maxTilesY; + } + int tileValueLimit = 600 + + (NPC.downedMechBossAny ? 100 : 0) + + (NPC.downedPlantBoss ? 100 : 0); + AchievementsHelper.CurrentlyMining = true; + for (int num824 = num815; num824 <= num816; num824++) + { + for (int num825 = num817; num825 <= num818; num825++) + { + value2.Y -= 2f; + float num826 = Math.Abs((float)num824 - value2.X / 16f); + float num827 = Math.Abs((float)num825 - value2.Y / 16f); + double num828 = Math.Sqrt((double)(num826 * num826 + num827 * num827)); + Tile tile = Framing.GetTileSafely(num824, num825); + if (num828 < (double)num814) + { + if (tile != null && tile.active() && tile.type != (ushort)mod.TileType("AbyssGravel") && + tile.type != (ushort)mod.TileType("Voidstone") && (tile.type != TileID.Hellstone || Main.hardMode) && + (tile.type != TileID.LihzahrdBrick || NPC.downedGolemBoss) && tile.type != TileID.BlueDungeonBrick && + tile.type != TileID.GreenDungeonBrick && tile.type != TileID.PinkDungeonBrick && + (tile.type != (ushort)mod.TileType("AstralOre") || CalamityWorld.downedStarGod) && + ((tile.type != (ushort)mod.TileType("Tenebris") && tile.type != (ushort)mod.TileType("PlantyMush")) || NPC.downedPlantBoss || CalamityWorld.downedCalamitas) && + (!player.GetModPlayer(mod).ZoneSunkenSea || CalamityWorld.downedDesertScourge) && + (Main.tileValue[tile.type] < tileValueLimit || tile.type == TileID.Heart || tile.type == TileID.LifeFruit)) + { + WorldGen.KillTile(num824, num825, false, false, false); + if (!Main.tile[num824, num825].active() && Main.netMode != 0) + { + NetMessage.SendData(17, -1, -1, null, 0, (float)num824, (float)num825, 0f, 0, 0, 0); + } + } + } + } + } + AchievementsHelper.CurrentlyMining = false; + } + } + } + } +} diff --git a/Items/Mounts/OnyxExcavatorExtra.png b/Items/Mounts/OnyxExcavatorExtra.png new file mode 100644 index 0000000000..3e3bab8b47 Binary files /dev/null and b/Items/Mounts/OnyxExcavatorExtra.png differ diff --git a/Items/Mounts/OnyxExcavatorExtra2.png b/Items/Mounts/OnyxExcavatorExtra2.png new file mode 100644 index 0000000000..e0ed00a7e4 Binary files /dev/null and b/Items/Mounts/OnyxExcavatorExtra2.png differ diff --git a/Items/Mounts/OnyxExcavator_Back.png b/Items/Mounts/OnyxExcavator_Back.png new file mode 100644 index 0000000000..e0ed00a7e4 Binary files /dev/null and b/Items/Mounts/OnyxExcavator_Back.png differ diff --git a/Items/Mounts/OnyxExcavator_Front.png b/Items/Mounts/OnyxExcavator_Front.png new file mode 100644 index 0000000000..e0ed00a7e4 Binary files /dev/null and b/Items/Mounts/OnyxExcavator_Front.png differ diff --git a/Items/NightmareFuel.cs b/Items/NightmareFuel.cs index b07fe76265..97ef5535b0 100644 --- a/Items/NightmareFuel.cs +++ b/Items/NightmareFuel.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Items item.width = 20; item.height = 20; item.maxStack = 999; + item.rare = 10; item.value = Item.buyPrice(0, 7, 50, 0); item.GetGlobalItem(mod).postMoonLordRarity = 14; } diff --git a/Items/Patreon/DragonPow.cs b/Items/Patreon/DragonPow.cs new file mode 100644 index 0000000000..3636116aa9 --- /dev/null +++ b/Items/Patreon/DragonPow.cs @@ -0,0 +1,71 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Patreon +{ + public class DragonPow : ModItem + { + public static int BaseDamage = 6600; + public static float Speed = 13f; + public static float ReturnSpeed = 20f; + public static float SparkSpeed = 0.6f; + public static float MinPetalSpeed = 24f; + public static float MaxPetalSpeed = 30f; + public static float MinWaterfallSpeed = 12f; + public static float MaxWaterfallSpeed = 15.5f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dragon Pow"); + } + + public override void SetDefaults() + { + item.width = 76; + item.height = 82; + item.melee = true; + item.damage = BaseDamage; + item.knockBack = 9f; + item.useAnimation = 20; + item.useTime = 20; + item.autoReuse = true; + item.noMelee = true; + item.noUseGraphic = true; + + item.useStyle = 5; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"); + item.channel = true; + + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.value = Item.buyPrice(1, 80, 0, 0); + + item.shoot = mod.ProjectileType("DragonPowFlail"); + item.shootSpeed = Speed; + } + + public override void AddRecipes() + { + ModRecipe r = new ModRecipe(mod); + r.SetResult(this); + r.AddTile(null, "DraedonsForge"); + r.AddIngredient(null, "Mourningstar"); + r.AddIngredient(ItemID.DaoofPow); + r.AddIngredient(ItemID.FlowerPow); + r.AddIngredient(ItemID.Flairon); + r.AddIngredient(null, "BallOFugu"); + r.AddIngredient(null, "Tumbleweed"); + r.AddIngredient(null, "UrchinFlail"); + r.AddIngredient(null, "CosmiliteBar", 5); + r.AddIngredient(null, "Phantoplasm", 5); + r.AddIngredient(null, "NightmareFuel", 5); + r.AddIngredient(null, "EndothermicEnergy", 5); + r.AddIngredient(null, "DarksunFragment", 5); + r.AddIngredient(null, "HellcasterFragment", 10); + r.AddIngredient(null, "AuricOre", 25); + r.AddRecipe(); + } + } +} diff --git a/Items/Patreon/DragonPow.png b/Items/Patreon/DragonPow.png new file mode 100644 index 0000000000..75549cacc8 Binary files /dev/null and b/Items/Patreon/DragonPow.png differ diff --git a/Items/Patreon/ForgottenDragonEgg.cs b/Items/Patreon/ForgottenDragonEgg.cs new file mode 100644 index 0000000000..2d54eee8df --- /dev/null +++ b/Items/Patreon/ForgottenDragonEgg.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Patreon +{ + public class ForgottenDragonEgg : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Forgotten Dragon Egg"); + Tooltip.SetDefault("Calls Akato, son of Yharon, to your side"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.ZephyrFish); + item.shoot = mod.ProjectileType("Akato"); + item.buffType = mod.BuffType("AkatoYharonBuff"); + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 3600, true); + } + } + } +} \ No newline at end of file diff --git a/Items/Patreon/ForgottenDragonEgg.png b/Items/Patreon/ForgottenDragonEgg.png new file mode 100644 index 0000000000..2611bd3f9d Binary files /dev/null and b/Items/Patreon/ForgottenDragonEgg.png differ diff --git a/Items/Patreon/GazeOfCrysthamyr.cs b/Items/Patreon/GazeOfCrysthamyr.cs new file mode 100644 index 0000000000..03edb297e9 --- /dev/null +++ b/Items/Patreon/GazeOfCrysthamyr.cs @@ -0,0 +1,42 @@ +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Patreon +{ + class GazeOfCrysthamyr : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gaze of Crysthamyr"); + Tooltip.SetDefault("Summons a shadow dragon"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 4; + item.rare = 10; + item.value = Item.buyPrice(3, 0, 0, 0); + item.UseSound = SoundID.NPCHit56; + item.noMelee = true; + item.mountType = mod.MountType("Crysthamyr"); + item.GetGlobalItem(mod).postMoonLordRarity = 21; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.DD2PetDragon); + recipe.AddIngredient(ItemID.SoulofNight, 100); + recipe.AddIngredient(null, "DarksunFragment", 50); + recipe.AddIngredient(null, "ExodiumClusterOre", 25); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Patreon/GazeOfCrysthamyr.png b/Items/Patreon/GazeOfCrysthamyr.png new file mode 100644 index 0000000000..ebd6fd25d9 Binary files /dev/null and b/Items/Patreon/GazeOfCrysthamyr.png differ diff --git a/Items/Patreon/Oracle.cs b/Items/Patreon/Oracle.cs new file mode 100644 index 0000000000..ad25c4f6ac --- /dev/null +++ b/Items/Patreon/Oracle.cs @@ -0,0 +1,69 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Patreon +{ + public class Oracle : ModItem + { + public static int BaseDamage = 1360; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Oracle"); + Tooltip.SetDefault("Emits an aura of red lightning\nFires auric orbs when supercharged\nHitting enemies charges the yoyo\n'Gaze into the past, the present, the future... and the circumstances of your inevitable demise'"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.Kraken); + + item.width = 54; + item.height = 42; + item.melee = true; + item.damage = BaseDamage; + item.knockBack = 4f; + item.useTime = 20; + item.useAnimation = 20; + item.autoReuse = true; + + item.useStyle = 5; + item.channel = true; + + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 21; + item.value = Item.buyPrice(1, 80, 0, 0); + + item.shoot = mod.ProjectileType("OracleYoyo"); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe r = new ModRecipe(mod); + r.SetResult(this); + r.AddTile(null, "DraedonsForge"); + r.AddIngredient(null, "TheObliterator"); + r.AddIngredient(null, "Lacerator"); + r.AddIngredient(null, "Verdant"); + r.AddIngredient(null, "Chaotrix"); + r.AddIngredient(null, "Quagmire"); + r.AddIngredient(null, "Shimmerspark"); + r.AddIngredient(null, "NightmareFuel", 5); + r.AddIngredient(null, "EndothermicEnergy", 5); + r.AddIngredient(null, "CosmiliteBar", 5); + r.AddIngredient(null, "DarksunFragment", 5); + r.AddIngredient(null, "Phantoplasm", 5); + r.AddIngredient(null, "HellcasterFragment", 3); + r.AddIngredient(null, "AuricOre", 25); + r.AddRecipe(); + } + } +} diff --git a/Items/Patreon/Oracle.png b/Items/Patreon/Oracle.png new file mode 100644 index 0000000000..bf1d403aba Binary files /dev/null and b/Items/Patreon/Oracle.png differ diff --git a/Items/Patreon/ProfanedSoulArtifact.cs b/Items/Patreon/ProfanedSoulArtifact.cs index ccad5441ae..4c629118fe 100644 --- a/Items/Patreon/ProfanedSoulArtifact.cs +++ b/Items/Patreon/ProfanedSoulArtifact.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Patreon public override void SetStaticDefaults() { DisplayName.SetDefault("Profaned Soul Artifact"); - Tooltip.SetDefault("Profanation\n" + //idk what tooltip haha + Tooltip.SetDefault("Purity\n" + "Summons a healer guardian which heals for a certain amount of health every few seconds\n" + "Summons a defensive guardian if you have at least 8 minion slots, which boosts your movement speed and your damage resistance\n" + "Summons an offensive guardian if you are wearing the tarragon summon set (or stronger), which boosts your summon damage and your minion slots\n" + diff --git a/Items/Patreon/ThePack.cs b/Items/Patreon/ThePack.cs index c51ddf1192..fb237674a4 100644 --- a/Items/Patreon/ThePack.cs +++ b/Items/Patreon/ThePack.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Patreon item.damage = 3000; item.crit += 10; item.ranged = true; - item.width = 142; - item.height = 62; + item.width = 96; + item.height = 40; item.useTime = 50; item.useAnimation = 50; item.useStyle = 5; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Patreon public override Vector2? HoldoutOffset() { - return new Vector2(-70, 0); + return new Vector2(-40, 0); } 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) diff --git a/Items/Patreon/ThePack.png b/Items/Patreon/ThePack.png index 00a6cffcc3..e865101e10 100644 Binary files a/Items/Patreon/ThePack.png and b/Items/Patreon/ThePack.png differ diff --git a/Items/Permafrost/AbsoluteZero.cs b/Items/Permafrost/AbsoluteZero.cs index 5d8e87257c..a2e035898b 100644 --- a/Items/Permafrost/AbsoluteZero.cs +++ b/Items/Permafrost/AbsoluteZero.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Permafrost } public override void SetDefaults() { - item.damage = 51; + item.damage = 42; item.melee = true; item.width = 58; item.height = 58; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Permafrost target.AddBuff(BuffID.Frostburn, 600); target.AddBuff(mod.BuffType("GlacialState"), 300); - int p = Projectile.NewProjectile(target.Center, Vector2.Zero, mod.ProjectileType("DarkIceZero"), damage / 3, knockBack * 3, player.whoAmI); + int p = Projectile.NewProjectile(target.Center, Vector2.Zero, mod.ProjectileType("DarkIceZero"), damage, knockBack * 3f, player.whoAmI); Main.projectile[p].Kill(); } } diff --git a/Items/Permafrost/CryogenicStaff.cs b/Items/Permafrost/CryogenicStaff.cs index 6b147e720a..1ea596b14b 100644 --- a/Items/Permafrost/CryogenicStaff.cs +++ b/Items/Permafrost/CryogenicStaff.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Permafrost Tooltip.SetDefault(@"Summons an animated ice construct to protect you Fire rate and range increase the longer it targets an enemy"); } + public override void SetDefaults() { item.damage = 56; @@ -32,10 +33,12 @@ Fire rate and range increase the longer it targets an enemy"); item.UseSound = SoundID.Item78; item.shoot = mod.ProjectileType("IceSentry"); } + public override bool AltFunctionUse(Player player) { return true; } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { if (player.altFunctionUse != 2) @@ -48,6 +51,7 @@ Fire rate and range increase the longer it targets an enemy"); } return false; } + public override bool UseItem(Player player) { if (player.altFunctionUse == 2) diff --git a/Items/Permafrost/PermafrostsConcoction.cs b/Items/Permafrost/PermafrostsConcoction.cs index a7be2ad83d..a65dfef523 100644 --- a/Items/Permafrost/PermafrostsConcoction.cs +++ b/Items/Permafrost/PermafrostsConcoction.cs @@ -17,6 +17,7 @@ Increases life regen when afflicted with Poison, On Fire, or Brimstone Flames You will survive fatal damage and revive with 30% life on a 3 minute cooldown You are encased in an ice barrier for 5 seconds when revived"); } + public override void SetDefaults() { item.accessory = true; @@ -25,6 +26,7 @@ You are encased in an ice barrier for 5 seconds when revived"); item.value = Item.buyPrice(0, 45, 0, 0); item.rare = 5; } + public override void UpdateAccessory(Player player, bool hideVisual) { player.statManaMax2 += 50; diff --git a/Items/PhantomHeart.cs b/Items/PhantomHeart.cs index 692702bb74..24c978abeb 100644 --- a/Items/PhantomHeart.cs +++ b/Items/PhantomHeart.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Items item.useStyle = 4; item.UseSound = SoundID.Item29; item.consumable = true; + item.rare = 10; item.GetGlobalItem(mod).postMoonLordRarity = 13; } diff --git a/Items/Phantoplasm.cs b/Items/Phantoplasm.cs index ab3e592887..6152f6bd43 100644 --- a/Items/Phantoplasm.cs +++ b/Items/Phantoplasm.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Items item.width = 12; item.height = 12; item.maxStack = 999; + item.rare = 10; item.value = Item.buyPrice(0, 7, 0, 0); item.GetGlobalItem(mod).postMoonLordRarity = 13; } diff --git a/Items/Placeables/AstralIce.png b/Items/Placeables/AstralIce.png index 28fe848001..4bb1c4ead4 100644 Binary files a/Items/Placeables/AstralIce.png and b/Items/Placeables/AstralIce.png differ diff --git a/Items/Placeables/AstralIceWall.png b/Items/Placeables/AstralIceWall.png index 6b42aa4194..b62cd18ac0 100644 Binary files a/Items/Placeables/AstralIceWall.png and b/Items/Placeables/AstralIceWall.png differ diff --git a/Items/Placeables/AstralSand.png b/Items/Placeables/AstralSand.png index 148bf7d0cb..aae699ed14 100644 Binary files a/Items/Placeables/AstralSand.png and b/Items/Placeables/AstralSand.png differ diff --git a/Items/Placeables/AstralSandstone.png b/Items/Placeables/AstralSandstone.png index 81a3887d0b..210ac0d1f6 100644 Binary files a/Items/Placeables/AstralSandstone.png and b/Items/Placeables/AstralSandstone.png differ diff --git a/Items/Placeables/AstralSandstoneWall.png b/Items/Placeables/AstralSandstoneWall.png index 68b9775b79..61ababdc19 100644 Binary files a/Items/Placeables/AstralSandstoneWall.png and b/Items/Placeables/AstralSandstoneWall.png differ diff --git a/Items/Placeables/Cinderplate.cs b/Items/Placeables/Cinderplate.cs index 6b6ad82d17..3b847f9c80 100644 --- a/Items/Placeables/Cinderplate.cs +++ b/Items/Placeables/Cinderplate.cs @@ -41,6 +41,11 @@ namespace CalamityMod.Items.Placeables recipe.SetResult(this); recipe.AddTile(TileID.Anvils); recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CinderplateWall", 4); + recipe.SetResult(this); + recipe.AddTile(TileID.Anvils); + recipe.AddRecipe(); } } } \ No newline at end of file diff --git a/Items/Placeables/Cinderplate.png b/Items/Placeables/Cinderplate.png index 85da9f2a14..7cdf92d326 100644 Binary files a/Items/Placeables/Cinderplate.png and b/Items/Placeables/Cinderplate.png differ diff --git a/Items/Placeables/CinderplateWall.png b/Items/Placeables/CinderplateWall.png index 6e1a870ed1..03b3da1392 100644 Binary files a/Items/Placeables/CinderplateWall.png and b/Items/Placeables/CinderplateWall.png differ diff --git a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.png b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.png index b69fa23fa9..1a7df72d4c 100644 Binary files a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.png and b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravel.png differ diff --git a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelWall.png b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelWall.png index abb66f2d9c..a6b7b9bacc 100644 Binary files a/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelWall.png and b/Items/Placeables/FurnitureAbyss/SmoothAbyssGravelWall.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs index 02f5cab520..b92bb1697a 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs +++ b/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(mod.ItemType("Navystone"), 1); + recipe.AddIngredient(mod.ItemType("Navystone")); recipe.SetResult(this, 2); recipe.AddTile(null, "EutrophicCrafting"); recipe.AddRecipe(); diff --git a/Items/Placeables/FurnitureStatigel/StatigelBlock.cs b/Items/Placeables/FurnitureStatigel/StatigelBlock.cs index aa9f53bc9e..7be3355790 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBlock.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBlock.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurifiedGel"); - recipe.SetResult(this); + recipe.AddIngredient(null, "PurifiedGel"); + recipe.SetResult(this, 10); recipe.AddTile(null, "StaticRefiner"); recipe.AddRecipe(); recipe = new ModRecipe(mod); diff --git a/Items/Placeables/FurnitureVoid/SmoothVoidstone.png b/Items/Placeables/FurnitureVoid/SmoothVoidstone.png index 6f096fe018..8687fa403c 100644 Binary files a/Items/Placeables/FurnitureVoid/SmoothVoidstone.png and b/Items/Placeables/FurnitureVoid/SmoothVoidstone.png differ diff --git a/Items/Placeables/FurnitureVoid/SmoothVoidstoneWall.png b/Items/Placeables/FurnitureVoid/SmoothVoidstoneWall.png index 923591f501..2e3a33172c 100644 Binary files a/Items/Placeables/FurnitureVoid/SmoothVoidstoneWall.png and b/Items/Placeables/FurnitureVoid/SmoothVoidstoneWall.png differ diff --git a/Items/Placeables/HallowedOre.png b/Items/Placeables/HallowedOre.png new file mode 100644 index 0000000000..6c80b6f840 Binary files /dev/null and b/Items/Placeables/HallowedOre.png differ diff --git a/Items/Placeables/HardenedAstralSand.png b/Items/Placeables/HardenedAstralSand.png index 64b2e8043c..2cc6f1b60b 100644 Binary files a/Items/Placeables/HardenedAstralSand.png and b/Items/Placeables/HardenedAstralSand.png differ diff --git a/Items/Placeables/HardenedAstralSandWall.png b/Items/Placeables/HardenedAstralSandWall.png index 0dc34a0b30..27a3b5a05e 100644 Binary files a/Items/Placeables/HardenedAstralSandWall.png and b/Items/Placeables/HardenedAstralSandWall.png differ diff --git a/Items/Placeables/Navystone.cs b/Items/Placeables/Navystone.cs index db6e6e3ba6..76e7ecfc06 100644 --- a/Items/Placeables/Navystone.cs +++ b/Items/Placeables/Navystone.cs @@ -37,6 +37,11 @@ namespace CalamityMod.Items.Placeables recipe.AddTile(18); recipe.SetResult(this); recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("EutrophicPlatform"), 2); + recipe.SetResult(this); + recipe.AddTile(null, "EutrophicCrafting"); + recipe.AddRecipe(); } } } \ No newline at end of file diff --git a/Items/Placeables/SulphurousSand.png b/Items/Placeables/SulphurousSand.png index e33c57ea3e..f812055202 100644 Binary files a/Items/Placeables/SulphurousSand.png and b/Items/Placeables/SulphurousSand.png differ diff --git a/Items/Placeables/UelibloomOre.cs b/Items/Placeables/UelibloomOre.cs index e790e41bc7..d1e6239a30 100644 --- a/Items/Placeables/UelibloomOre.cs +++ b/Items/Placeables/UelibloomOre.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Items.Placeables item.width = 10; item.height = 10; item.maxStack = 999; + item.rare = 10; item.value = Item.buyPrice(0, 0, 10, 0); } diff --git a/Items/Placeables/Voidstone.png b/Items/Placeables/Voidstone.png index 3cbb79e8d9..dcfd997f15 100644 Binary files a/Items/Placeables/Voidstone.png and b/Items/Placeables/Voidstone.png differ diff --git a/Items/Placeables/VoidstoneWall.png b/Items/Placeables/VoidstoneWall.png index 26ff0d7a52..3bb6ffa518 100644 Binary files a/Items/Placeables/VoidstoneWall.png and b/Items/Placeables/VoidstoneWall.png differ diff --git a/Items/Polterghast/Affliction.cs b/Items/Polterghast/Affliction.cs index 86050c161b..4e9a559e8d 100644 --- a/Items/Polterghast/Affliction.cs +++ b/Items/Polterghast/Affliction.cs @@ -9,42 +9,37 @@ using CalamityMod.Items; namespace CalamityMod.Items.Polterghast { - public class Affliction : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Affliction"); - Tooltip.SetDefault("Gives you and all other players on your team +1 life regen,\n" + - "+5% max life, 5% damage reduction, 15 defense, and 10% increased damage\n" + - "These effects are stronger on revengeance mode"); - } + public class Affliction : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Affliction"); + Tooltip.SetDefault("Gives you and all other players on your team +1 life regen,\n" + + "+5% max life, 5% damage reduction, 15 defense, and 10% increased damage\n" + + "These effects are stronger on revengeance mode"); + } - public override void SetDefaults() - { - item.width = 20; - item.height = 20; - item.value = Item.buyPrice(0, 60, 0, 0); - item.accessory = true; - item.expert = true; - } + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 60, 0, 0); + item.accessory = true; + item.expert = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.affliction = true; - if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) - { - int myPlayer = Main.myPlayer; - if (Main.player[myPlayer].team == player.team && player.team != 0) - { - float arg = player.position.X - Main.player[myPlayer].position.X; - float num3 = player.position.Y - Main.player[myPlayer].position.Y; - if ((float)Math.Sqrt((double)(arg * arg + num3 * num3)) < 2800f) - { - Main.player[myPlayer].AddBuff(mod.BuffType("Afflicted"), 20, true); - } - } - } - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.affliction = true; + if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) + { + int myPlayer = Main.myPlayer; + if (Main.player[myPlayer].team == player.team && player.team != 0) + { + Main.player[myPlayer].AddBuff(mod.BuffType("Afflicted"), 20, true); + } + } + } + } } \ No newline at end of file diff --git a/Items/Polterghast/NecroplasmicBeacon.cs b/Items/Polterghast/NecroplasmicBeacon.cs index 0be83b2936..778cf76a35 100644 --- a/Items/Polterghast/NecroplasmicBeacon.cs +++ b/Items/Polterghast/NecroplasmicBeacon.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Polterghast public override bool CanUseItem(Player player) { - return player.ZoneDungeon && !NPC.AnyNPCs(mod.NPCType("Polterghast")); + return player.ZoneDungeon && !NPC.AnyNPCs(mod.NPCType("Polterghast")) && CalamityWorld.downedBossAny; } public override bool UseItem(Player player) diff --git a/Items/PotionofOmniscience.png b/Items/PotionofOmniscience.png deleted file mode 100644 index 95875297ce..0000000000 Binary files a/Items/PotionofOmniscience.png and /dev/null differ diff --git a/Items/Potions/AstralInjection.cs b/Items/Potions/AstralInjection.cs new file mode 100644 index 0000000000..7214303414 --- /dev/null +++ b/Items/Potions/AstralInjection.cs @@ -0,0 +1,65 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Items.Potions +{ + public class AstralInjection : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Astral Injection"); + Tooltip.SetDefault("Gives mana sickness and hurts you when used, but you regenerate mana extremely quickly even while moving or casting spells"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("AstralInjectionBuff"); + item.buffTime = 180; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void OnConsumeItem(Player player) + { + player.AddBuff(BuffID.ManaSickness, Player.manaSickTime / 2, true); + player.statLife -= 5; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(-5, true); + } + if (player.statLife <= 0) + { + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 4); + recipe.AddIngredient(null, "Stardust", 4); + recipe.AddIngredient(null, "AstralJelly"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 4); + recipe.AddIngredient(null, "BloodOrb", 5); + recipe.AddIngredient(null, "AstralJelly"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/AstralInjection.png b/Items/Potions/AstralInjection.png new file mode 100644 index 0000000000..e2fa5a60a8 Binary files /dev/null and b/Items/Potions/AstralInjection.png differ diff --git a/Items/Potions/BoundingPotion.cs b/Items/Potions/BoundingPotion.cs new file mode 100644 index 0000000000..e5d06a08de --- /dev/null +++ b/Items/Potions/BoundingPotion.cs @@ -0,0 +1,49 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class BoundingPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bounding Potion"); + Tooltip.SetDefault("Increases jump height, jump speed, and fall damage resistance"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("BoundingBuff"); + item.buffTime = 10800; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ItemID.Frog); + recipe.AddIngredient(null, "ManeaterBulb"); + recipe.AddTile(TileID.Bottles); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 20); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/BoundingPotion.png b/Items/Potions/BoundingPotion.png new file mode 100644 index 0000000000..b478412caf Binary files /dev/null and b/Items/Potions/BoundingPotion.png differ diff --git a/Items/Potions/CadencePotion.cs b/Items/Potions/CadencePotion.cs new file mode 100644 index 0000000000..c54d431e72 --- /dev/null +++ b/Items/Potions/CadencePotion.cs @@ -0,0 +1,53 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class CadencePotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cadance Potion"); + Tooltip.SetDefault("Gives the cadence buff which reduces shop prices and enemy aggro\n" + + "Increases life regen and increases max life by 10%\n" + + "Increases heart pickup range"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Cadence"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.LovePotion); + recipe.AddIngredient(ItemID.HeartreachPotion); + recipe.AddIngredient(ItemID.LifeforcePotion); + recipe.AddIngredient(ItemID.RegenerationPotion); + recipe.AddIngredient(ItemID.CalmingPotion); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 40); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/CadencePotion.png b/Items/Potions/CadencePotion.png similarity index 100% rename from Items/CadencePotion.png rename to Items/Potions/CadencePotion.png diff --git a/Items/CalamitasBrew.cs b/Items/Potions/CalamitasBrew.cs similarity index 59% rename from Items/CalamitasBrew.cs rename to Items/Potions/CalamitasBrew.cs index 8830cb1cc4..8dce3d7fce 100644 --- a/Items/CalamitasBrew.cs +++ b/Items/Potions/CalamitasBrew.cs @@ -1,49 +1,49 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class CalamitasBrew : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Calamitas' Brew"); - Tooltip.SetDefault("Adds abyssal flames to your melee projectiles and melee attacks\n" + - "Increases your movement speed by 15%"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("AbyssalWeapon"); - item.buffTime = 36000; - item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CalamityDust"); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.ImbuingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 20); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class CalamitasBrew : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calamitas' Brew"); + Tooltip.SetDefault("Adds abyssal flames to your melee projectiles and melee attacks\n" + + "Increases your movement speed by 15%"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("AbyssalWeapon"); + item.buffTime = 36000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "CalamityDust"); + recipe.AddTile(TileID.ImbuingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 20); + recipe.AddTile(TileID.ImbuingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/CalamitasBrew.png b/Items/Potions/CalamitasBrew.png similarity index 100% rename from Items/CalamitasBrew.png rename to Items/Potions/CalamitasBrew.png diff --git a/Items/Potions/CalciumPotion.cs b/Items/Potions/CalciumPotion.cs new file mode 100644 index 0000000000..6da05ad64d --- /dev/null +++ b/Items/Potions/CalciumPotion.cs @@ -0,0 +1,48 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class CalciumPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Calcium Potion"); + Tooltip.SetDefault("Grants immunity to fall damage"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("CalciumBuff"); + item.buffTime = 36000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "AncientBoneDust"); + recipe.AddTile(TileID.Bottles); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/CalciumPotion.png b/Items/Potions/CalciumPotion.png new file mode 100644 index 0000000000..001ef25f40 Binary files /dev/null and b/Items/Potions/CalciumPotion.png differ diff --git a/Items/Potions/CeaselessHungerPotion.cs b/Items/Potions/CeaselessHungerPotion.cs new file mode 100644 index 0000000000..39e06d0add --- /dev/null +++ b/Items/Potions/CeaselessHungerPotion.cs @@ -0,0 +1,50 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class CeaselessHungerPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ceaseless Hunger Potion"); + Tooltip.SetDefault("Causes you to suck up all items in the world"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("CeaselessHunger"); + item.buffTime = 600; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 4); + recipe.AddIngredient(null, "DarkPlasma"); + recipe.AddIngredient(null, "GalacticaSingularity"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 4); + recipe.AddIngredient(null, "BloodOrb", 20); + recipe.AddIngredient(null, "DarkPlasma"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this, 4); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/CeaselessHungerPotion.png b/Items/Potions/CeaselessHungerPotion.png new file mode 100644 index 0000000000..7ca0c12506 Binary files /dev/null and b/Items/Potions/CeaselessHungerPotion.png differ diff --git a/Items/Potions/CrumblingPotion.cs b/Items/Potions/CrumblingPotion.cs new file mode 100644 index 0000000000..bcb3d5a41b --- /dev/null +++ b/Items/Potions/CrumblingPotion.cs @@ -0,0 +1,51 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class CrumblingPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crumbling Potion"); + Tooltip.SetDefault("Increases melee and rogue critical strike chance by 5%\n" + + "Melee and rogue attacks break enemy armor"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("ArmorCrumbling"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 5); + recipe.AddIngredient(null, "AncientBoneDust"); + recipe.AddIngredient(ItemID.AncientBattleArmorMaterial); + recipe.AddIngredient(null, "EssenceofCinder"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this, 5); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 20); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/CrumblingPotion.png b/Items/Potions/CrumblingPotion.png new file mode 100644 index 0000000000..fa9e4979a0 Binary files /dev/null and b/Items/Potions/CrumblingPotion.png differ diff --git a/Items/Potions/DraconicElixir.cs b/Items/Potions/DraconicElixir.cs new file mode 100644 index 0000000000..eb4b3d076b --- /dev/null +++ b/Items/Potions/DraconicElixir.cs @@ -0,0 +1,60 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class DraconicElixir : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draconic Elixir"); + Tooltip.SetDefault("Greatly increases wing flight time and speed and increases defense by 16\n" + + "God slayer revival heals you to full HP instead of 150 HP when triggered\n" + + "Silva invincibility heals you to full HP when triggered\n" + + "If you trigger the above heals you cannot drink this potion again for 30 seconds"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("DraconicSurgeBuff"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override bool CanUseItem(Player player) + { + return player.GetModPlayer(mod).draconicSurgeCooldown == 0; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "HellcasterFragment"); + recipe.AddIngredient(ItemID.Daybloom); + recipe.AddIngredient(ItemID.Moonglow); + recipe.AddIngredient(ItemID.Fireblossom); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 50); + recipe.AddIngredient(null, "HellcasterFragment"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/DraconicElixir.png b/Items/Potions/DraconicElixir.png new file mode 100644 index 0000000000..cf908b428a Binary files /dev/null and b/Items/Potions/DraconicElixir.png differ diff --git a/Items/Potions/GravityNormalizerPotion.cs b/Items/Potions/GravityNormalizerPotion.cs new file mode 100644 index 0000000000..904085dac0 --- /dev/null +++ b/Items/Potions/GravityNormalizerPotion.cs @@ -0,0 +1,49 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class GravityNormalizerPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gravity Normalizer Potion"); + Tooltip.SetDefault("Disables the low gravity of space and grants immunity to the distorted debuff"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("GravityNormalizerBuff"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GravitationPotion); + recipe.AddIngredient(null, "AstralJelly"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(null, "AstralJelly"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/GravityNormalizerPotion.png b/Items/Potions/GravityNormalizerPotion.png new file mode 100644 index 0000000000..d25a2ba87a Binary files /dev/null and b/Items/Potions/GravityNormalizerPotion.png differ diff --git a/Items/Potions/HolyWrathPotion.cs b/Items/Potions/HolyWrathPotion.cs new file mode 100644 index 0000000000..b163a98fe4 --- /dev/null +++ b/Items/Potions/HolyWrathPotion.cs @@ -0,0 +1,51 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class HolyWrathPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Holy Wrath Potion"); + Tooltip.SetDefault("Increases damage by 12% and increases movement and horizontal flight speed by 5%\n" + + "Attacks inflict holy fire"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("HolyWrathBuff"); + item.buffTime = 10800; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.WrathPotion); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddIngredient(null, "GalacticaSingularity"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 40); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/HolyWrathPotion.png b/Items/Potions/HolyWrathPotion.png new file mode 100644 index 0000000000..e9f51ed973 Binary files /dev/null and b/Items/Potions/HolyWrathPotion.png differ diff --git a/Items/OmegaHealingPotion.cs b/Items/Potions/OmegaHealingPotion.cs similarity index 93% rename from Items/OmegaHealingPotion.cs rename to Items/Potions/OmegaHealingPotion.cs index 5a93a94ff2..81d27ec963 100644 --- a/Items/OmegaHealingPotion.cs +++ b/Items/Potions/OmegaHealingPotion.cs @@ -1,45 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; - -namespace CalamityMod.Items -{ - public class OmegaHealingPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Omega Healing Potion"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.healLife = 300; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.potion = true; - item.value = Item.buyPrice(0, 7, 0, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 13; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "SupremeHealingPotion"); - recipe.AddIngredient(null, "BloodOrb", 10); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Items.Potions +{ + public class OmegaHealingPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Omega Healing Potion"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.healLife = 300; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.potion = true; + item.rare = 10; + item.value = Item.buyPrice(0, 7, 0, 0); + item.GetGlobalItem(mod).postMoonLordRarity = 13; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "SupremeHealingPotion"); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/OmegaHealingPotion.png b/Items/Potions/OmegaHealingPotion.png similarity index 100% rename from Items/OmegaHealingPotion.png rename to Items/Potions/OmegaHealingPotion.png diff --git a/Items/Potions/PenumbraPotion.cs b/Items/Potions/PenumbraPotion.cs new file mode 100644 index 0000000000..dafa1d41c4 --- /dev/null +++ b/Items/Potions/PenumbraPotion.cs @@ -0,0 +1,51 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class PenumbraPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Penumbra Potion"); + Tooltip.SetDefault("Rogue stealth always builds during nighttime and twice as fast during a solar eclipse, even while moving"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("PenumbraBuff"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "CalamityDust", 3); + recipe.AddIngredient(ItemID.LunarTabletFragment, 2); + recipe.AddIngredient(null, "EssenceofChaos"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 30); + recipe.AddIngredient(ItemID.LunarTabletFragment); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/PenumbraPotion.png b/Items/Potions/PenumbraPotion.png new file mode 100644 index 0000000000..9edcdde054 Binary files /dev/null and b/Items/Potions/PenumbraPotion.png differ diff --git a/Items/Potions/PhotosynthesisPotion.cs b/Items/Potions/PhotosynthesisPotion.cs new file mode 100644 index 0000000000..685f7fec63 --- /dev/null +++ b/Items/Potions/PhotosynthesisPotion.cs @@ -0,0 +1,52 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class PhotosynthesisPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Photosynthesis Potion"); + Tooltip.SetDefault("You regen life quickly while not moving, this effect is five times as strong during daytime\n" + + "Dropped hearts heal more HP"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("PhotosynthesisBuff"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BeetleJuice", 2); + recipe.AddIngredient(null, "ManeaterBulb"); + recipe.AddIngredient(null, "TrapperBulb"); + recipe.AddIngredient(null, "EssenceofCinder"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 40); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/PhotosynthesisPotion.png b/Items/Potions/PhotosynthesisPotion.png new file mode 100644 index 0000000000..94458d2478 Binary files /dev/null and b/Items/Potions/PhotosynthesisPotion.png differ diff --git a/Items/PotionofOmniscience.cs b/Items/Potions/PotionofOmniscience.cs similarity index 63% rename from Items/PotionofOmniscience.cs rename to Items/Potions/PotionofOmniscience.cs index 499193fdbc..35c83f8b5c 100644 --- a/Items/PotionofOmniscience.cs +++ b/Items/Potions/PotionofOmniscience.cs @@ -1,49 +1,49 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class PotionofOmniscience : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Potion of Omniscience"); - Tooltip.SetDefault("Gives creature, danger, and treasure detection"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("Omniscience"); - item.buffTime = 18000; - item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.HunterPotion); - recipe.AddIngredient(ItemID.SpelunkerPotion); - recipe.AddIngredient(ItemID.TrapsightPotion); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 20); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class PotionofOmniscience : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Potion of Omniscience"); + Tooltip.SetDefault("Gives creature, danger, and treasure detection"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Omniscience"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HunterPotion); + recipe.AddIngredient(ItemID.SpelunkerPotion); + recipe.AddIngredient(ItemID.TrapsightPotion); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 20); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Potions/PotionofOmniscience.png b/Items/Potions/PotionofOmniscience.png new file mode 100644 index 0000000000..8b2a8030e0 Binary files /dev/null and b/Items/Potions/PotionofOmniscience.png differ diff --git a/Items/Potions/ProfanedRagePotion.cs b/Items/Potions/ProfanedRagePotion.cs new file mode 100644 index 0000000000..9e1d51189a --- /dev/null +++ b/Items/Potions/ProfanedRagePotion.cs @@ -0,0 +1,51 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class ProfanedRagePotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Profaned Rage Potion"); + Tooltip.SetDefault("Increases critical strike chance by 12% and increases movement and horizontal flight speed by 5%\n" + + "In Revengeance Mode you gain more rage when damaged"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("ProfanedRageBuff"); + item.buffTime = 10800; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.RagePotion); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddIngredient(null, "GalacticaSingularity"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 40); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/ProfanedRagePotion.png b/Items/Potions/ProfanedRagePotion.png new file mode 100644 index 0000000000..bf88fd779d Binary files /dev/null and b/Items/Potions/ProfanedRagePotion.png differ diff --git a/Items/Potions/PurifiedJam.cs b/Items/Potions/PurifiedJam.cs new file mode 100644 index 0000000000..f96f152c1a --- /dev/null +++ b/Items/Potions/PurifiedJam.cs @@ -0,0 +1,45 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class PurifiedJam : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Purified Jam"); + Tooltip.SetDefault("Makes you immune to all damage and most debuffs for 10 seconds (5 seconds in Death Mode)\n" + + "Causes potion sickness when consumed\n" + + "Cannot be consumed while potion sickness is active\n" + + "Revengeance drop"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override bool CanUseItem(Player player) + { + return player.FindBuffIndex(BuffID.PotionSickness) == -1; + } + + public override bool UseItem(Player player) + { + player.AddBuff(mod.BuffType("Invincible"), (CalamityWorld.death ? 300 : 600)); + player.AddBuff(BuffID.PotionSickness, (player.pStone ? 1500 : 1800)); + return true; + } + } +} \ No newline at end of file diff --git a/Items/PurifiedJam.png b/Items/Potions/PurifiedJam.png similarity index 100% rename from Items/PurifiedJam.png rename to Items/Potions/PurifiedJam.png diff --git a/Items/Potions/RevivifyPotion.cs b/Items/Potions/RevivifyPotion.cs new file mode 100644 index 0000000000..cf9b275dca --- /dev/null +++ b/Items/Potions/RevivifyPotion.cs @@ -0,0 +1,59 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class RevivifyPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Revivify Potion"); + Tooltip.SetDefault("Causes enemy attacks to heal you for a fraction of their damage for 15 seconds"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override bool UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = item.useTime; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.revivifyTimer = 900; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HolyWater, 5); + recipe.AddIngredient(null, "Stardust", 20); + recipe.AddIngredient(ItemID.CrystalShard, 5); + recipe.AddIngredient(null, "EssenceofCinder", 3); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.HolyWater, 5); + recipe.AddIngredient(null, "BloodOrb", 50); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/RevivifyPotion.png b/Items/Potions/RevivifyPotion.png similarity index 100% rename from Items/RevivifyPotion.png rename to Items/Potions/RevivifyPotion.png diff --git a/Items/Potions/ShatteringPotion.cs b/Items/Potions/ShatteringPotion.cs new file mode 100644 index 0000000000..b06ec64fb7 --- /dev/null +++ b/Items/Potions/ShatteringPotion.cs @@ -0,0 +1,50 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class ShatteringPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shattering Potion"); + Tooltip.SetDefault("Increases melee and rogue damage and critical strike chance by 8%\n" + + "Melee and rogue attacks break enemy armor"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("ArmorShattering"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CrumblingPotion", 2); + recipe.AddIngredient(ItemID.BeetleHusk); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 30); + recipe.AddIngredient(ItemID.BeetleHusk); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/ShatteringPotion.png b/Items/Potions/ShatteringPotion.png new file mode 100644 index 0000000000..0a787e1a5d Binary files /dev/null and b/Items/Potions/ShatteringPotion.png differ diff --git a/Items/Potions/SoaringPotion.cs b/Items/Potions/SoaringPotion.cs new file mode 100644 index 0000000000..ed958e4ca6 --- /dev/null +++ b/Items/Potions/SoaringPotion.cs @@ -0,0 +1,50 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class SoaringPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soaring Potion"); + Tooltip.SetDefault("Increases flight time and horizontal flight speed by 10%"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("Soaring"); + item.buffTime = 14400; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(ItemID.Feather); + recipe.AddIngredient(ItemID.SoulofFlight); + recipe.AddIngredient(null, "EssenceofCinder"); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 30); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/SoaringPotion.png b/Items/Potions/SoaringPotion.png new file mode 100644 index 0000000000..ca4dcd43ed Binary files /dev/null and b/Items/Potions/SoaringPotion.png differ diff --git a/Items/SupremeHealingPotion.cs b/Items/Potions/SupremeHealingPotion.cs similarity index 93% rename from Items/SupremeHealingPotion.cs rename to Items/Potions/SupremeHealingPotion.cs index 5c1dfa0698..833a06843f 100644 --- a/Items/SupremeHealingPotion.cs +++ b/Items/Potions/SupremeHealingPotion.cs @@ -1,45 +1,46 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; - -namespace CalamityMod.Items -{ - public class SupremeHealingPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Supreme Healing Potion"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.healLife = 250; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.potion = true; - item.value = Item.buyPrice(0, 6, 50, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SuperHealingPotion); - recipe.AddIngredient(null, "UnholyEssence"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Items.Potions +{ + public class SupremeHealingPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Supreme Healing Potion"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.healLife = 250; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.potion = true; + item.rare = 10; + item.value = Item.buyPrice(0, 6, 50, 0); + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SuperHealingPotion); + recipe.AddIngredient(null, "UnholyEssence"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/Potions/SupremeHealingPotion.png b/Items/Potions/SupremeHealingPotion.png new file mode 100644 index 0000000000..259ded9846 Binary files /dev/null and b/Items/Potions/SupremeHealingPotion.png differ diff --git a/Items/SupremeManaPotion.cs b/Items/Potions/SupremeManaPotion.cs similarity index 93% rename from Items/SupremeManaPotion.cs rename to Items/Potions/SupremeManaPotion.cs index 04fe361560..fe8b150d1f 100644 --- a/Items/SupremeManaPotion.cs +++ b/Items/Potions/SupremeManaPotion.cs @@ -1,44 +1,45 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.DataStructures; - -namespace CalamityMod.Items -{ - public class SupremeManaPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Supreme Mana Potion"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 999; - item.healMana = 400; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.value = Item.buyPrice(0, 6, 50, 0); - item.GetGlobalItem(mod).postMoonLordRarity = 12; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.SuperManaPotion); - recipe.AddIngredient(null, "Phantoplasm"); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; + +namespace CalamityMod.Items.Potions +{ + public class SupremeManaPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Supreme Mana Potion"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 999; + item.healMana = 400; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.rare = 10; + item.value = Item.buyPrice(0, 6, 50, 0); + item.GetGlobalItem(mod).postMoonLordRarity = 12; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SuperManaPotion); + recipe.AddIngredient(null, "Phantoplasm"); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/SupremeManaPotion.png b/Items/Potions/SupremeManaPotion.png similarity index 100% rename from Items/SupremeManaPotion.png rename to Items/Potions/SupremeManaPotion.png diff --git a/Items/TitanScalePotion.cs b/Items/Potions/TitanScalePotion.cs similarity index 72% rename from Items/TitanScalePotion.cs rename to Items/Potions/TitanScalePotion.cs index de0f635f5e..005b46c17d 100644 --- a/Items/TitanScalePotion.cs +++ b/Items/Potions/TitanScalePotion.cs @@ -1,48 +1,49 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class TitanScalePotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Titan Scale Potion"); - Tooltip.SetDefault("Increases knockback, defense by 5, and damage reduction by 5%"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.buffType = mod.BuffType("TitanScale"); - item.buffTime = 18000; - item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.TitanPotion); - recipe.AddIngredient(ItemID.BeetleHusk); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 20); - recipe.AddIngredient(ItemID.BottledWater); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class TitanScalePotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titan Scale Potion"); + Tooltip.SetDefault("Increases knockback, defense by 5, and damage reduction by 5%"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("TitanScale"); + item.buffTime = 18000; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.TitanPotion); + recipe.AddIngredient(ItemID.BeetleHusk); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 10); + recipe.AddIngredient(ItemID.BeetleHusk); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } \ No newline at end of file diff --git a/Items/TitanScalePotion.png b/Items/Potions/TitanScalePotion.png similarity index 100% rename from Items/TitanScalePotion.png rename to Items/Potions/TitanScalePotion.png diff --git a/Items/Potions/TriumphPotion.cs b/Items/Potions/TriumphPotion.cs new file mode 100644 index 0000000000..40dc550fd5 --- /dev/null +++ b/Items/Potions/TriumphPotion.cs @@ -0,0 +1,49 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class TriumphPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Triumph Potion"); + Tooltip.SetDefault("Enemy contact damage is reduced, the lower their health the more it is reduced"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = mod.BuffType("TriumphBuff"); + item.buffTime = 7200; + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "StormlionMandible"); + recipe.AddIngredient(null, "VictoryShard", 3); + recipe.AddTile(TileID.Bottles); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddIngredient(null, "BloodOrb", 30); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Potions/TriumphPotion.png b/Items/Potions/TriumphPotion.png new file mode 100644 index 0000000000..17ad97826b Binary files /dev/null and b/Items/Potions/TriumphPotion.png differ diff --git a/Items/Providence/ProfanedCore.cs b/Items/Providence/ProfanedCore.cs index 177d4023a0..9c8d7aa95c 100644 --- a/Items/Providence/ProfanedCore.cs +++ b/Items/Providence/ProfanedCore.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Providence public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight); + return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight) && CalamityWorld.downedBossAny; } public override bool UseItem(Player player) diff --git a/Items/Providence/ProfanedCoreUnlimited.cs b/Items/Providence/ProfanedCoreUnlimited.cs index e8cbcb708e..51275ab8d1 100644 --- a/Items/Providence/ProfanedCoreUnlimited.cs +++ b/Items/Providence/ProfanedCoreUnlimited.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Providence public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight); + return !NPC.AnyNPCs(mod.NPCType("Providence")) && Main.dayTime && (player.ZoneHoly || player.ZoneUnderworldHeight) && CalamityWorld.downedBossAny; } public override bool UseItem(Player player) diff --git a/Items/Providence/ProvidenceBag.cs b/Items/Providence/ProvidenceBag.cs index 414510d459..308c739c59 100644 --- a/Items/Providence/ProvidenceBag.cs +++ b/Items/Providence/ProvidenceBag.cs @@ -73,6 +73,10 @@ namespace CalamityMod.Items.Providence { player.QuickSpawnItem(mod.ItemType("TelluricGlare")); } + if (Main.rand.Next(40) == 0) + { + player.QuickSpawnItem(mod.ItemType("SamuraiBadge")); + } if (Main.rand.Next(7) == 0) { player.QuickSpawnItem(mod.ItemType("ProvidenceMask")); diff --git a/Items/PurifiedJam.cs b/Items/PurifiedJam.cs deleted file mode 100644 index 91d41b6fab..0000000000 --- a/Items/PurifiedJam.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class PurifiedJam : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Purified Jam"); - Tooltip.SetDefault("Makes you immune to all damage and most debuffs for 10 seconds (5 seconds in Death Mode)\n" + - "Causes potion sickness when consumed\n" + - "Cannot be consumed while potion sickness is active\n" + - "Revengeance drop"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override bool CanUseItem(Player player) - { - return player.FindBuffIndex(BuffID.PotionSickness) == -1; - } - - public override bool UseItem(Player player) - { - player.AddBuff(mod.BuffType("Invincible"), (CalamityWorld.death ? 300 : 600)); - player.AddBuff(BuffID.PotionSickness, (player.pStone ? 1500 : 1800)); - return true; - } - } -} \ No newline at end of file diff --git a/Items/RedLightningContainer.cs b/Items/RedLightningContainer.cs index cbcb09501a..27a5c6d285 100644 --- a/Items/RedLightningContainer.cs +++ b/Items/RedLightningContainer.cs @@ -29,7 +29,8 @@ namespace CalamityMod.Items item.useStyle = 4; item.UseSound = SoundID.Item122; item.consumable = true; - item.GetGlobalItem(mod).postMoonLordRarity = 14; + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 12; } public override bool CanUseItem(Player player) diff --git a/Items/RevivifyPotion.cs b/Items/RevivifyPotion.cs deleted file mode 100644 index e69d9afef3..0000000000 --- a/Items/RevivifyPotion.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items -{ - public class RevivifyPotion : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Revivify Potion"); - Tooltip.SetDefault("Causes enemy attacks to heal you for a fraction of their damage for 15 seconds"); - } - - public override void SetDefaults() - { - item.width = 28; - item.height = 18; - item.useTurn = true; - item.maxStack = 30; - item.rare = 3; - item.useAnimation = 17; - item.useTime = 17; - item.useStyle = 2; - item.UseSound = SoundID.Item3; - item.consumable = true; - item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override bool UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = item.useTime; - CalamityPlayer modPlayer = player.GetModPlayer(mod); - modPlayer.revivifyTimer = 900; - } - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "Stardust", 20); - recipe.AddIngredient(ItemID.HolyWater, 5); - recipe.AddIngredient(ItemID.CrystalShard, 5); - recipe.AddIngredient(null, "EssenceofCinder", 3); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BloodOrb", 50); - recipe.AddIngredient(ItemID.HolyWater, 5); - recipe.AddTile(TileID.AlchemyTable); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } -} \ No newline at end of file diff --git a/Items/RomajedaOrchid.cs b/Items/RomajedaOrchid.cs new file mode 100644 index 0000000000..85007c6464 --- /dev/null +++ b/Items/RomajedaOrchid.cs @@ -0,0 +1,41 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class RomajedaOrchid : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Romajeda Orchid"); + Tooltip.SetDefault("Summons a never forgotten friend"); + } + + public override void SetDefaults() + { + item.damage = 0; + item.useStyle = 1; + item.useAnimation = 20; + item.useTime = 20; + item.noMelee = true; + item.width = 30; + item.height = 30; + item.value = Item.sellPrice(1, 0, 0, 0); + item.shoot = mod.ProjectileType("Kendra"); + item.buffType = mod.BuffType("Kendra"); + item.rare = 5; + item.UseSound = SoundID.Item44; + } + + public override void UseStyle(Player player) + { + if (player.whoAmI == Main.myPlayer && player.itemTime == 0) + { + player.AddBuff(item.buffType, 15, true); + } + } + } +} diff --git a/Items/RomajedaOrchid.png b/Items/RomajedaOrchid.png new file mode 100644 index 0000000000..a196f80639 Binary files /dev/null and b/Items/RomajedaOrchid.png differ diff --git a/Items/Scavenger/RavagerBag.cs b/Items/Scavenger/RavagerBag.cs index 419283d816..7d0fdc84ed 100644 --- a/Items/Scavenger/RavagerBag.cs +++ b/Items/Scavenger/RavagerBag.cs @@ -83,9 +83,23 @@ namespace CalamityMod.Items.Scavenger { player.QuickSpawnItem(mod.ItemType("FleshTotem")); } - if (Main.rand.Next(2) == 0) + switch (Main.rand.Next(5)) { - player.QuickSpawnItem(mod.ItemType("Hematemesis")); + case 0: + player.QuickSpawnItem(mod.ItemType("Hematemesis")); + break; + case 1: + player.QuickSpawnItem(mod.ItemType("RealmRavager")); + break; + case 2: + player.QuickSpawnItem(mod.ItemType("SpikecragStaff")); + break; + case 3: + player.QuickSpawnItem(mod.ItemType("UltimusCleaver")); + break; + case 4: + player.QuickSpawnItem(mod.ItemType("CraniumSmasher")); + break; } } } diff --git a/Items/ShadowspecBar.cs b/Items/ShadowspecBar.cs index ef14e93eb1..671fa357b6 100644 --- a/Items/ShadowspecBar.cs +++ b/Items/ShadowspecBar.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Items item.width = 15; item.height = 12; item.maxStack = 999; + item.rare = 10; item.value = Item.buyPrice(0, 10, 0, 0); item.GetGlobalItem(mod).postMoonLordRarity = 15; } diff --git a/Items/ShrineItems/CorruptionEffigy.cs b/Items/ShrineItems/CorruptionEffigy.cs new file mode 100644 index 0000000000..82f72c08bb --- /dev/null +++ b/Items/ShrineItems/CorruptionEffigy.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.ShrineItems +{ + public class CorruptionEffigy: ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Corruption Effigy"); + Tooltip.SetDefault("When placed down nearby players have their movement speed increased by 15% and crit chance by 10%\n" + + "Nearby players also suffer a 20% decrease to their damage reduction"); + } + + public override void SetDefaults() + { + item.width = 26; + item.height = 32; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.createTile = mod.TileType("CorruptionEffigy"); + } + } +} \ No newline at end of file diff --git a/Items/ShrineItems/CorruptionEffigy.png b/Items/ShrineItems/CorruptionEffigy.png new file mode 100644 index 0000000000..d7ba8c6e67 Binary files /dev/null and b/Items/ShrineItems/CorruptionEffigy.png differ diff --git a/Items/ShrineItems/CrimsonEffigy.cs b/Items/ShrineItems/CrimsonEffigy.cs new file mode 100644 index 0000000000..34463691e4 --- /dev/null +++ b/Items/ShrineItems/CrimsonEffigy.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.ShrineItems +{ + public class CrimsonEffigy: ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Crimson Effigy"); + Tooltip.SetDefault("When placed down nearby players have their damage increased by 15% and defense by 10\n" + + "Nearby players also suffer a 20% decrease to their maximum health"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 32; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.createTile = mod.TileType("CrimsonEffigy"); + } + } +} \ No newline at end of file diff --git a/Items/ShrineItems/CrimsonEffigy.png b/Items/ShrineItems/CrimsonEffigy.png new file mode 100644 index 0000000000..28df6f8fa0 Binary files /dev/null and b/Items/ShrineItems/CrimsonEffigy.png differ diff --git a/Items/ShrineItems/FungalSymbiote.cs b/Items/ShrineItems/FungalSymbiote.cs new file mode 100644 index 0000000000..9cb65d5395 --- /dev/null +++ b/Items/ShrineItems/FungalSymbiote.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.ShrineItems +{ + public class FungalSymbiote : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fungal Symbiote"); + Tooltip.SetDefault("True melee weapons emit mushrooms when swung\n" + + "Boosts true melee damage by 25%"); + } + + public override void SetDefaults() + { + item.width = 38; + item.height = 36; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.fungalSymbiote = true; + } + } +} \ No newline at end of file diff --git a/Items/ShrineItems/FungalSymbiote.png b/Items/ShrineItems/FungalSymbiote.png new file mode 100644 index 0000000000..97274bf76d Binary files /dev/null and b/Items/ShrineItems/FungalSymbiote.png differ diff --git a/Items/ShrineItems/GladiatorsLocket.cs b/Items/ShrineItems/GladiatorsLocket.cs new file mode 100644 index 0000000000..1078b09430 --- /dev/null +++ b/Items/ShrineItems/GladiatorsLocket.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.GameContent; +using Terraria.IO; +using Terraria.ObjectData; +using Terraria.Utilities; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.ShrineItems +{ + public class GladiatorsLocket : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gladiator's Locket"); + Tooltip.SetDefault("Summons two spirit swords to protect you"); + } + + public override void SetDefaults() + { + item.width = 42; + item.height = 36; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.defense = 5; + item.accessory = true; + } + + public override bool CanEquipAccessory(Player player, int slot) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); //there might be an upgrade sometime later? + if (modPlayer.gladiatorSword) + { + return false; + } + return true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.gladiatorSword = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(mod.BuffType("GladiatorSwords")) == -1) + { + player.AddBuff(mod.BuffType("GladiatorSwords"), 3600, true); + } + if (player.ownedProjectileCounts[mod.ProjectileType("GladiatorSword")] < 1) + { + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("GladiatorSword"), (int)(20f * player.minionDamage), 6f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("GladiatorSword2"), (int)(20f * player.minionDamage), 6f, Main.myPlayer, 0f, 0f); + } + } + } + } +} \ No newline at end of file diff --git a/Items/ShrineItems/GladiatorsLocket.png b/Items/ShrineItems/GladiatorsLocket.png new file mode 100644 index 0000000000..ee4ef6f68a Binary files /dev/null and b/Items/ShrineItems/GladiatorsLocket.png differ diff --git a/Items/ShrineItems/LuxorsGift.cs b/Items/ShrineItems/LuxorsGift.cs new file mode 100644 index 0000000000..c2e60f27cb --- /dev/null +++ b/Items/ShrineItems/LuxorsGift.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.ShrineItems +{ + public class LuxorsGift : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Luxor's Gift"); + Tooltip.SetDefault("Weapons fire unique projectiles based on the damage type they have\n" + + "Some weapons are unable to receive this bonus"); + } + + public override void SetDefaults() + { + item.width = 58; + item.height = 48; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.luxorsGift = true; + } + } +} \ No newline at end of file diff --git a/Items/ShrineItems/LuxorsGift.png b/Items/ShrineItems/LuxorsGift.png new file mode 100644 index 0000000000..cecdcac2f8 Binary files /dev/null and b/Items/ShrineItems/LuxorsGift.png differ diff --git a/Items/ShrineItems/OnyxExcavatorKey.cs b/Items/ShrineItems/OnyxExcavatorKey.cs new file mode 100644 index 0000000000..f2accec800 --- /dev/null +++ b/Items/ShrineItems/OnyxExcavatorKey.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.ShrineItems +{ + class OnyxExcavatorKey : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Onyx Excavator Key"); + Tooltip.SetDefault("Summons a drill to drill through the world so you can destroy all the neat world generation\n" + + "with complete disregard for all the creatures that inhabit these lands. I am sure the EPA and PETA would like\n" + + "to have a word with you afterwards."); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 4; + item.rare = 3; + item.value = Item.buyPrice(0, 9, 0, 0); + item.UseSound = SoundID.Item23; + item.noMelee = true; + item.mountType = mod.MountType("OnyxExcavator"); + } + } +} diff --git a/Items/ShrineItems/OnyxExcavatorKey.png b/Items/ShrineItems/OnyxExcavatorKey.png new file mode 100644 index 0000000000..4b9ede2615 Binary files /dev/null and b/Items/ShrineItems/OnyxExcavatorKey.png differ diff --git a/Items/ShrineItems/TrinketofChi.cs b/Items/ShrineItems/TrinketofChi.cs new file mode 100644 index 0000000000..65a875c56d --- /dev/null +++ b/Items/ShrineItems/TrinketofChi.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.ShrineItems +{ + public class TrinketofChi : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Trinket of Chi"); + Tooltip.SetDefault("After 2 seconds of standing still and not attacking you gain a buff\n" + + "This buff boosts your damage by 50% and decreases damage taken by 15%\n" + + "The buff deactivates after you move or attack once"); + } + + public override void SetDefaults() + { + item.width = 34; + item.height = 32; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.trinketOfChi = true; + } + } +} \ No newline at end of file diff --git a/Items/ShrineItems/TrinketofChi.png b/Items/ShrineItems/TrinketofChi.png new file mode 100644 index 0000000000..7928c1d2d8 Binary files /dev/null and b/Items/ShrineItems/TrinketofChi.png differ diff --git a/Items/ShrineItems/TundraLeash.cs b/Items/ShrineItems/TundraLeash.cs new file mode 100644 index 0000000000..644c44a791 --- /dev/null +++ b/Items/ShrineItems/TundraLeash.cs @@ -0,0 +1,29 @@ +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.ShrineItems +{ + class TundraLeash : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tundra Leash"); + Tooltip.SetDefault("Summons an angry dog mount"); + } + + public override void SetDefaults() + { + item.width = 16; + item.height = 16; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 4; + item.rare = 3; + item.value = Item.buyPrice(0, 9, 0, 0); + item.UseSound = SoundID.NPCHit56; + item.noMelee = true; + item.mountType = mod.MountType("AngryDog"); + } + } +} diff --git a/Items/ShrineItems/TundraLeash.png b/Items/ShrineItems/TundraLeash.png new file mode 100644 index 0000000000..fa77ad51ef Binary files /dev/null and b/Items/ShrineItems/TundraLeash.png differ diff --git a/Items/ShrineItems/UnstablePrism.cs b/Items/ShrineItems/UnstablePrism.cs new file mode 100644 index 0000000000..d752d597a3 --- /dev/null +++ b/Items/ShrineItems/UnstablePrism.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.ShrineItems +{ + public class UnstablePrism : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Unstable Prism"); + Tooltip.SetDefault("Three sparks are released on critical hits"); + } + + public override void SetDefaults() + { + item.width = 22; + item.height = 38; + item.value = Item.buyPrice(0, 9, 0, 0); + item.rare = 3; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.unstablePrism = true; + } + } +} \ No newline at end of file diff --git a/Items/ShrineItems/UnstablePrism.png b/Items/ShrineItems/UnstablePrism.png new file mode 100644 index 0000000000..dabdd4e99a Binary files /dev/null and b/Items/ShrineItems/UnstablePrism.png differ diff --git a/Items/SquishyBeanMount.cs b/Items/SquishyBeanMount.cs index 730efde911..305eb78bf4 100644 --- a/Items/SquishyBeanMount.cs +++ b/Items/SquishyBeanMount.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Items item.useTime = 20; item.useAnimation = 20; item.useStyle = 1; + item.rare = 10; item.value = Item.buyPrice(1, 0, 0, 0); item.expert = true; item.UseSound = SoundID.Item3; diff --git a/Items/StarterBag.cs b/Items/StarterBag.cs index 62d1998375..4b0517e49d 100644 --- a/Items/StarterBag.cs +++ b/Items/StarterBag.cs @@ -32,8 +32,7 @@ namespace CalamityMod.Items player.QuickSpawnItem(ItemID.WoodenArrow, 100); player.QuickSpawnItem(ItemID.AmethystStaff); //mage needs player.QuickSpawnItem(ItemID.ManaCrystal); - player.QuickSpawnItem(ItemID.Shuriken, 75); //throwing needs - player.QuickSpawnItem(ItemID.ThrowingKnife, 75); + player.QuickSpawnItem(mod.ItemType("WulfrumKnife"), 150); player.QuickSpawnItem(ItemID.SlimeStaff); //summoner needs player.QuickSpawnItem(ItemID.CopperHammer); //tool needs player.QuickSpawnItem(ItemID.MiningPotion); //mining needs diff --git a/Items/SupremeCalamitas/EyeofExtinction.cs b/Items/SupremeCalamitas/EyeofExtinction.cs index 240116beb1..7be42ee8bd 100644 --- a/Items/SupremeCalamitas/EyeofExtinction.cs +++ b/Items/SupremeCalamitas/EyeofExtinction.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.SupremeCalamitas public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")); + return !NPC.AnyNPCs(mod.NPCType("SupremeCalamitas")) && CalamityWorld.downedBossAny; } public override bool UseItem(Player player) diff --git a/Items/SupremeHealingPotion.png b/Items/SupremeHealingPotion.png deleted file mode 100644 index ef4c1cf6bd..0000000000 Binary files a/Items/SupremeHealingPotion.png and /dev/null differ diff --git a/Items/TheDevourerofGods/CosmicWorm.cs b/Items/TheDevourerofGods/CosmicWorm.cs index 3e5af1fd0d..ef29d64f96 100644 --- a/Items/TheDevourerofGods/CosmicWorm.cs +++ b/Items/TheDevourerofGods/CosmicWorm.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.TheDevourerofGods public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHead")) && !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS")) && CalamityWorld.DoGSecondStageCountdown <= 0; + return !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHead")) && !NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS")) && CalamityWorld.DoGSecondStageCountdown <= 0 && CalamityWorld.downedBossAny; } public override bool UseItem(Player player) diff --git a/Items/TheDevourerofGods/DevourerofGodsBag.cs b/Items/TheDevourerofGods/DevourerofGodsBag.cs index fa20a47926..678d6619f6 100644 --- a/Items/TheDevourerofGods/DevourerofGodsBag.cs +++ b/Items/TheDevourerofGods/DevourerofGodsBag.cs @@ -76,6 +76,14 @@ namespace CalamityMod.Items.TheDevourerofGods } } player.TryGettingDevArmor(); + if (Main.rand.Next(40) == 0) + { + player.QuickSpawnItem(mod.ItemType("Norfleet")); + } + if (Main.rand.Next(40) == 0) + { + player.QuickSpawnItem(mod.ItemType("Skullmasher")); + } if (Main.rand.Next(3) == 0) { player.QuickSpawnItem(mod.ItemType("DeathhailStaff")); diff --git a/Items/UeliaceBar.cs b/Items/UeliaceBar.cs index e1c7881b35..d4036ebb6d 100644 --- a/Items/UeliaceBar.cs +++ b/Items/UeliaceBar.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Items item.width = 15; item.height = 12; item.maxStack = 999; + item.rare = 10; item.value = Item.buyPrice(0, 6, 50, 0); item.GetGlobalItem(mod).postMoonLordRarity = 12; } diff --git a/Items/Weapons/AMR.cs b/Items/Weapons/AMR.cs index e7492632d2..3c2707dad9 100644 --- a/Items/Weapons/AMR.cs +++ b/Items/Weapons/AMR.cs @@ -57,8 +57,8 @@ namespace CalamityMod.Items.Weapons 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("AMR"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("AMR"), damage, knockBack, player.whoAmI, 0f, 0f); return false; } - } + } } \ No newline at end of file diff --git a/Items/Weapons/AbyssBlade.cs b/Items/Weapons/AbyssBlade.cs index 17fcbc554d..653713c654 100644 --- a/Items/Weapons/AbyssBlade.cs +++ b/Items/Weapons/AbyssBlade.cs @@ -13,13 +13,15 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Abyss Blade"); - Tooltip.SetDefault("Hitting enemies will cause the crush depth debuff\nThe lower the enemies' defense the more damage they take from this debuff"); + Tooltip.SetDefault("Hitting enemies will cause the crush depth debuff\n" + + "The lower the enemies' defense the more damage they take from this debuff\n" + + "Fires short-range water orbs"); } public override void SetDefaults() { item.width = 60; - item.damage = 100; + item.damage = 110; item.melee = true; item.useAnimation = 17; item.useTime = 17; @@ -32,7 +34,7 @@ namespace CalamityMod.Items.Weapons item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; item.shoot = mod.ProjectileType("DepthOrb"); - item.shootSpeed = 19f; + item.shootSpeed = 9f; } public override void AddRecipes() diff --git a/Items/Weapons/AbyssWeapons/CalamarisLament.cs b/Items/Weapons/AbyssWeapons/CalamarisLament.cs index 1fe44dd387..5818882af1 100644 --- a/Items/Weapons/AbyssWeapons/CalamarisLament.cs +++ b/Items/Weapons/AbyssWeapons/CalamarisLament.cs @@ -44,35 +44,30 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons item.GetGlobalItem(mod).postMoonLordRarity = 13; } - 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) - { - float num72 = item.shootSpeed; - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/HerringStaff.cs b/Items/Weapons/AbyssWeapons/HerringStaff.cs index ea47089594..367bd25d6e 100644 --- a/Items/Weapons/AbyssWeapons/HerringStaff.cs +++ b/Items/Weapons/AbyssWeapons/HerringStaff.cs @@ -43,35 +43,30 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons item.summon = 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) - { - float num72 = item.shootSpeed; - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - } + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } \ No newline at end of file diff --git a/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.png b/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.png index efd3fc59c2..82dc8b5801 100644 Binary files a/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.png and b/Items/Weapons/AbyssWeapons/SulphuricAcidCannon.png differ diff --git a/Items/Weapons/Aeries.cs b/Items/Weapons/Aeries.cs index 60298010e2..df92541f1c 100644 --- a/Items/Weapons/Aeries.cs +++ b/Items/Weapons/Aeries.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ShockblastRound"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ShockblastRound"), damage, knockBack, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/AethersWhisper.cs b/Items/Weapons/AethersWhisper.cs index fee9d99b21..b314b35823 100644 --- a/Items/Weapons/AethersWhisper.cs +++ b/Items/Weapons/AethersWhisper.cs @@ -14,8 +14,7 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Aether's Whisper"); - Tooltip.SetDefault("Fires an energy beam that does more damage the further it travels\n" + - "Inflicts several long-lasting debuffs and splits on tile hits\n" + + Tooltip.SetDefault("Inflicts several long-lasting debuffs and splits on tile hits\n" + "Right click to change from magic to ranged damage"); } @@ -67,7 +66,14 @@ namespace CalamityMod.Items.Weapons return base.CanUseItem(player); } - public override void AddRecipes() + 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) + { + float ai0 = (player.altFunctionUse == 2 ? 1f : 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, ai0, 0f); + return false; + } + + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "PlasmaRod"); diff --git a/Items/Weapons/Alluvion.cs b/Items/Weapons/Alluvion.cs index 6453e5b906..225a924a35 100644 --- a/Items/Weapons/Alluvion.cs +++ b/Items/Weapons/Alluvion.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -22,7 +23,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { - item.damage = 45; + item.damage = 90; item.ranged = true; item.width = 44; item.height = 58; @@ -72,12 +73,13 @@ namespace CalamityMod.Items.Weapons { type = mod.ProjectileType("TyphoonArrow"); } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[num121].noDropItem = true; + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[num121].noDropItem = true; } else { - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[num121].noDropItem = true; } } diff --git a/Items/Weapons/AlphaRay.cs b/Items/Weapons/AlphaRay.cs index fbc7b6997d..6bda71dbfb 100644 --- a/Items/Weapons/AlphaRay.cs +++ b/Items/Weapons/AlphaRay.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Alpha Ray"); - Tooltip.SetDefault("Disintegrates everything\nRight click to change modes"); + Tooltip.SetDefault("Disintegrates everything\n" + + "Right click to change modes"); } diff --git a/Items/Weapons/AnarchyBlade.cs b/Items/Weapons/AnarchyBlade.cs index d9b77b4bb6..98c5e668ff 100644 --- a/Items/Weapons/AnarchyBlade.cs +++ b/Items/Weapons/AnarchyBlade.cs @@ -61,14 +61,21 @@ namespace CalamityMod.Items.Weapons public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BrimstoneBoom"), (int)((double)item.damage * 0.75), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("BrimstoneBoom"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - if (player.statLife < (player.statLifeMax2 * 0.5f) && Main.rand.Next(5) == 0 && !target.boss) + + if (player.statLife < (player.statLifeMax2 * 0.5f) && Main.rand.Next(5) == 0 && !target.boss && target.type != 477 && + target.type != 327 && target.type != 135 && target.type != 136 && target.type != 325 && target.type != 344 && target.type != 346 && target.type != 345 && + target.type != mod.NPCType("Reaper") && target.type != mod.NPCType("Mauler") && target.type != mod.NPCType("EidolonWyrmHead") && + target.type != mod.NPCType("EidolonWyrmHeadHuge") && target.type != mod.NPCType("ColossalSquid") && target.type != NPCID.DD2Betsy) { - target.life = 0; - target.HitEffect(0, 10.0); - target.active = false; - target.NPCLoot(); + if (!CalamityPlayer.areThereAnyDamnBosses) + { + target.life = 0; + target.HitEffect(0, 10.0); + target.active = false; + target.NPCLoot(); + } } } } diff --git a/Items/Weapons/Animosity.png b/Items/Weapons/Animosity.png index cbb71f34a4..e6df7ae736 100644 Binary files a/Items/Weapons/Animosity.png and b/Items/Weapons/Animosity.png differ diff --git a/Items/Weapons/ApoctosisArray.png b/Items/Weapons/ApoctosisArray.png index 9a63365287..9d31bbf2f3 100644 Binary files a/Items/Weapons/ApoctosisArray.png and b/Items/Weapons/ApoctosisArray.png differ diff --git a/Items/Weapons/AquaticScourge/DeepseaStaff.cs b/Items/Weapons/AquaticScourge/DeepseaStaff.cs index 54f88f1e3d..fde63de6ed 100644 --- a/Items/Weapons/AquaticScourge/DeepseaStaff.cs +++ b/Items/Weapons/AquaticScourge/DeepseaStaff.cs @@ -42,37 +42,31 @@ namespace CalamityMod.Items.Weapons.AquaticScourge item.shootSpeed = 10f; item.summon = 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) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); - Vector2 vector3 = Main.MouseWorld - vector2; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("AquaticStar"), damage, knockBack, player.whoAmI, 0f, 0f); return false; - } + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } } } \ No newline at end of file diff --git a/Items/Weapons/ArchAmaryllis.cs b/Items/Weapons/ArchAmaryllis.cs index e0aaf090b7..f4ebaf5d36 100644 --- a/Items/Weapons/ArchAmaryllis.cs +++ b/Items/Weapons/ArchAmaryllis.cs @@ -7,7 +7,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; -namespace CalamityMod.Items.Weapons +namespace CalamityMod.Items.Weapons { public class ArchAmaryllis : ModItem { @@ -37,8 +37,8 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("BeamingBolt"); item.shootSpeed = 20f; } - - public override void AddRecipes() + + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "GleamingMagnolia"); diff --git a/Items/Weapons/ArkoftheAncients.cs b/Items/Weapons/ArkoftheAncients.cs index 61ec5d052c..a8c1c5012c 100644 --- a/Items/Weapons/ArkoftheAncients.cs +++ b/Items/Weapons/ArkoftheAncients.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -88,8 +89,9 @@ namespace CalamityMod.Items.Weapons num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-120, 121) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-120, 121) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, damage, knockBack, player.whoAmI, 1f, (float)Main.rand.Next(5)); - } + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, damage, knockBack, player.whoAmI, 0f, (float)Main.rand.Next(5)); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } return false; } diff --git a/Items/Weapons/AstrealDefeat.cs b/Items/Weapons/AstrealDefeat.cs index f73129f2ad..1e4f406bf1 100644 --- a/Items/Weapons/AstrealDefeat.cs +++ b/Items/Weapons/AstrealDefeat.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("AstrealArrow"), (int)((double)damage), knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("AstrealArrow"), (int)((double)damage), knockBack, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/AstrumDeus/BlackBolt.png b/Items/Weapons/AstrumDeus/BlackBolt.png deleted file mode 100644 index dd7dd3a2aa..0000000000 Binary files a/Items/Weapons/AstrumDeus/BlackBolt.png and /dev/null differ diff --git a/Items/Weapons/AstrumDeus/Starfall.cs b/Items/Weapons/AstrumDeus/Starfall.cs index ff166905db..1c0549427c 100644 --- a/Items/Weapons/AstrumDeus/Starfall.cs +++ b/Items/Weapons/AstrumDeus/Starfall.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Weapons.AstrumDeus { float speedX4 = 2f + (float)Main.rand.Next(-8, 5); float speedY5 = 15f + (float)Main.rand.Next(1, 6); - int star = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 1f, 0f); + int star = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/BladedgeGreatbow.cs b/Items/Weapons/BladedgeGreatbow.cs index 324547a1b8..dc2c93c96c 100644 --- a/Items/Weapons/BladedgeGreatbow.cs +++ b/Items/Weapons/BladedgeGreatbow.cs @@ -6,7 +6,6 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; -//using TerrariaOverhaul; namespace CalamityMod.Items.Weapons { @@ -37,12 +36,12 @@ namespace CalamityMod.Items.Weapons item.useAmmo = 40; } - /*public void OverhaulInit() - { - this.SetTag("crossbow"); - }*/ + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { for (int i = 0; i < 5; i++) { diff --git a/Items/Weapons/BrimlashBuster.cs b/Items/Weapons/BrimlashBuster.cs index 8277cfe073..0eb7424424 100644 --- a/Items/Weapons/BrimlashBuster.cs +++ b/Items/Weapons/BrimlashBuster.cs @@ -59,11 +59,11 @@ namespace CalamityMod.Items.Weapons target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); if (Main.rand.Next(3) == 0) { - item.damage = 360; + item.damage = 378; } else { - item.damage = 120; + item.damage = 126; } } } diff --git a/Items/Weapons/BrimstoneFury.cs b/Items/Weapons/BrimstoneFury.cs index f4d52e8c2a..d60aa21526 100644 --- a/Items/Weapons/BrimstoneFury.cs +++ b/Items/Weapons/BrimstoneFury.cs @@ -6,61 +6,55 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; -//using TerrariaOverhaul; -namespace CalamityMod.Items.Weapons +namespace CalamityMod.Items.Weapons { public class BrimstoneFury : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Brimstone Fury"); - } - - public override void SetDefaults() - { - item.damage = 21; - item.ranged = true; - item.width = 30; - item.height = 58; - item.useTime = 22; - item.useAnimation = 22; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 3.75f; - item.value = Item.buyPrice(0, 48, 0, 0); - item.rare = 6; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = mod.ProjectileType("BrimstoneBolt"); - item.shootSpeed = 13f; - item.useAmmo = 40; - } - - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - 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 numProj = 2; - float rotation = MathHelper.ToRadians(3); - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBolt"), damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; } - - public override void AddRecipes() + + public override void SetDefaults() + { + item.damage = 21; + item.ranged = true; + item.width = 30; + item.height = 58; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3.75f; + item.value = Item.buyPrice(0, 48, 0, 0); + item.rare = 6; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BrimstoneBolt"); + item.shootSpeed = 13f; + item.useAmmo = 40; + } + + 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 numProj = 2; + float rotation = MathHelper.ToRadians(3); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("BrimstoneBolt"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "UnholyCore", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); } } } \ No newline at end of file diff --git a/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs b/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs index 7ad85b7b6d..ef41c7b505 100644 --- a/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs +++ b/Items/Weapons/BrimstoneWaifu/SeethingDischarge.cs @@ -45,9 +45,9 @@ namespace CalamityMod.Items.Weapons.BrimstoneWaifu float SpeedY2 = speedY - 10f * 0.05f; float SpeedX3 = speedX + 0f * 0.05f; float SpeedY3 = speedY + 0f * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, mod.ProjectileType("SeethingDischargeBrimstoneHellblast"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, mod.ProjectileType("SeethingDischargeBrimstoneHellblast"), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX3, SpeedY3, type, damage, knockBack, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/BurntSienna.cs b/Items/Weapons/BurntSienna.cs index 70d65f39af..d215897ee3 100644 --- a/Items/Weapons/BurntSienna.cs +++ b/Items/Weapons/BurntSienna.cs @@ -6,7 +6,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Weapons +namespace CalamityMod.Items.Weapons { public class BurntSienna : ModItem { @@ -29,25 +29,13 @@ namespace CalamityMod.Items.Weapons item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 54; - item.value = Item.buyPrice(0, 4, 0, 0); - item.rare = 3; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; item.shootSpeed = 5f; } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Amber, 5); - recipe.AddIngredient(ItemID.AshBlock, 30); - recipe.AddIngredient(ItemID.Obsidian, 10); - recipe.AddIngredient(ItemID.MeteoriteBar, 6); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { + { float spread = 180f * 0.0174f; double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - spread / 2; double deltaAngle = spread / 8f; @@ -55,30 +43,30 @@ namespace CalamityMod.Items.Weapons int i; if (target.life <= 0) { - for (i = 0; i < 1; i++ ) + for (i = 0; i < 1; i++) { float randomSpeedX = (float)Main.rand.Next(3); float randomSpeedY = (float)Main.rand.Next(3, 5); - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - int projectile1 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BurntSienna"), item.damage, knockback, Main.myPlayer); - int projectile2 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BurntSienna"), item.damage, knockback, Main.myPlayer); - int projectile3 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("BurntSienna"), item.damage, knockback, Main.myPlayer); - Main.projectile[projectile1].velocity.X = -randomSpeedX; - Main.projectile[projectile1].velocity.Y = -randomSpeedY; - Main.projectile[projectile2].velocity.X = randomSpeedX; - Main.projectile[projectile2].velocity.Y = -randomSpeedY; - Main.projectile[projectile3].velocity.X = 0f; - Main.projectile[projectile3].velocity.Y = -randomSpeedY; + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int projectile1 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BurntSienna"), 0, 0f, Main.myPlayer); + int projectile2 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BurntSienna"), 0, 0f, Main.myPlayer); + int projectile3 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("BurntSienna"), 0, 0f, Main.myPlayer); + Main.projectile[projectile1].velocity.X = -randomSpeedX; + Main.projectile[projectile1].velocity.Y = -randomSpeedY; + Main.projectile[projectile2].velocity.X = randomSpeedX; + Main.projectile[projectile2].velocity.Y = -randomSpeedY; + Main.projectile[projectile3].velocity.X = 0f; + Main.projectile[projectile3].velocity.Y = -randomSpeedY; } } } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(5) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246); - } - } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(5) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246); + } + } } } diff --git a/Items/Weapons/Calamitas/BlightedEyeStaff.png b/Items/Weapons/Calamitas/BlightedEyeStaff.png index 09c1b8c52b..7503c09f9d 100644 Binary files a/Items/Weapons/Calamitas/BlightedEyeStaff.png and b/Items/Weapons/Calamitas/BlightedEyeStaff.png differ diff --git a/Items/Weapons/Calamitas/BrimstoneFlameblaster.png b/Items/Weapons/Calamitas/BrimstoneFlameblaster.png index a44bdf043f..380f5e719a 100644 Binary files a/Items/Weapons/Calamitas/BrimstoneFlameblaster.png and b/Items/Weapons/Calamitas/BrimstoneFlameblaster.png differ diff --git a/Items/Weapons/Calamitas/BrimstoneFlamesprayer.png b/Items/Weapons/Calamitas/BrimstoneFlamesprayer.png index eab466724e..14e3c4e4ba 100644 Binary files a/Items/Weapons/Calamitas/BrimstoneFlamesprayer.png and b/Items/Weapons/Calamitas/BrimstoneFlamesprayer.png differ diff --git a/Items/Weapons/Calamitas/CalamitasInferno.png b/Items/Weapons/Calamitas/CalamitasInferno.png index 38c9176a23..127f4b2dd6 100644 Binary files a/Items/Weapons/Calamitas/CalamitasInferno.png and b/Items/Weapons/Calamitas/CalamitasInferno.png differ diff --git a/Items/Weapons/Calamitas/TheEyeofCalamitas.png b/Items/Weapons/Calamitas/TheEyeofCalamitas.png index 141a1fcf44..3d25fe1600 100644 Binary files a/Items/Weapons/Calamitas/TheEyeofCalamitas.png and b/Items/Weapons/Calamitas/TheEyeofCalamitas.png differ diff --git a/Items/Weapons/CausticEdge.cs b/Items/Weapons/CausticEdge.cs index c73114c07b..7af241c6c4 100644 --- a/Items/Weapons/CausticEdge.cs +++ b/Items/Weapons/CausticEdge.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Caustic Edge"); - Tooltip.SetDefault("Give Sick"); + Tooltip.SetDefault("Inflicts poison and venom on enemy hits"); } public override void SetDefaults() @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons item.useAnimation = 27; item.useStyle = 1; item.useTime = 27; - item.knockBack = 5; + item.knockBack = 5f; item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 48; @@ -55,6 +55,7 @@ namespace CalamityMod.Items.Weapons public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Poisoned, 480); + target.AddBuff(BuffID.Venom, 240); } } } diff --git a/Items/Weapons/CausticEdge.png b/Items/Weapons/CausticEdge.png index 71a9b11719..57ad421b37 100644 Binary files a/Items/Weapons/CausticEdge.png and b/Items/Weapons/CausticEdge.png differ diff --git a/Items/Weapons/Chaotrix.cs b/Items/Weapons/Chaotrix.cs index 4ad1e7ed19..3ee859d483 100644 --- a/Items/Weapons/Chaotrix.cs +++ b/Items/Weapons/Chaotrix.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { item.CloneDefaults(ItemID.Yelets); - item.damage = 150; + item.damage = 110; item.useTime = 22; item.useAnimation = 22; item.useStyle = 5; diff --git a/Items/Weapons/CleansingBlaze.cs b/Items/Weapons/CleansingBlaze.cs index d45c601486..224ca18dc4 100644 --- a/Items/Weapons/CleansingBlaze.cs +++ b/Items/Weapons/CleansingBlaze.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Items.Weapons { DisplayName.SetDefault("Cleansing Blaze"); Tooltip.SetDefault("90% chance to not consume gel"); - } - - public override void SetDefaults() - { + } + + public override void SetDefaults() + { item.damage = 250; item.ranged = true; item.width = 60; @@ -29,46 +29,46 @@ namespace CalamityMod.Items.Weapons item.noMelee = true; item.knockBack = 4f; item.UseSound = SoundID.Item34; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.autoReuse = true; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.autoReuse = true; item.shoot = mod.ProjectileType("EssenceFire"); item.shootSpeed = 14f; item.useAmmo = 23; item.GetGlobalItem(mod).postMoonLordRarity = 14; } - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + + 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 num6 = Main.rand.Next(2, 4); - for (int index = 0; index < num6; ++index) - { - float SpeedX = speedX + (float) Main.rand.Next(-15, 16) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-15, 16) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; + int num6 = Main.rand.Next(2, 4); + for (int index = 0; index < num6; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; } - - public override Vector2? HoldoutOffset() + + public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); } - - public override bool ConsumeAmmo(Player player) - { - if (Main.rand.Next(0, 100) < 90) - return false; - return true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "CosmiliteBar", 12); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 90) + return false; + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "CosmiliteBar", 12); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } \ No newline at end of file diff --git a/Items/Weapons/Climax.cs b/Items/Weapons/Climax.cs index 849ca8b4dd..e98745e637 100644 --- a/Items/Weapons/Climax.cs +++ b/Items/Weapons/Climax.cs @@ -7,7 +7,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; -namespace CalamityMod.Items.Weapons +namespace CalamityMod.Items.Weapons { public class Climax : ModItem { @@ -16,74 +16,74 @@ namespace CalamityMod.Items.Weapons DisplayName.SetDefault("Voltaic Climax"); Tooltip.SetDefault("Fires a circular spread of magnetic orbs around the mouse cursor"); Item.staff[item.type] = true; - } - - public override void SetDefaults() - { - item.damage = 90; - item.magic = true; - item.mana = 30; - item.width = 78; - item.height = 78; - item.useTime = 30; - item.useAnimation = 30; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 5f; - item.value = Item.buyPrice(1, 80, 0, 0); - item.rare = 10; - item.UseSound = SoundID.Item20; - item.autoReuse = true; - item.shoot = mod.ProjectileType("Climax"); - item.shootSpeed = 12f; + } + + public override void SetDefaults() + { + item.damage = 90; + item.magic = true; + item.mana = 30; + item.width = 78; + item.height = 78; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Climax"); + item.shootSpeed = 12f; item.GetGlobalItem(mod).postMoonLordRarity = 14; } - - 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) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - vector2 += new Vector2(num78, num79); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(speedX, speedY) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); - } - return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "MagneticMeltdown"); - recipe.AddIngredient(null, "DarksunFragment", 15); - recipe.AddTile(null, "DraedonsForge"); - recipe.SetResult(this); - recipe.AddRecipe(); - } + + 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) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + vector2 += new Vector2(num78, num79); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(speedX, speedY) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "MagneticMeltdown"); + recipe.AddIngredient(null, "DarksunFragment", 15); + recipe.AddTile(null, "DraedonsForge"); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } \ No newline at end of file diff --git a/Items/Weapons/CometQuasher.cs b/Items/Weapons/CometQuasher.cs index be78c28ab5..3d91fd2d4e 100644 --- a/Items/Weapons/CometQuasher.cs +++ b/Items/Weapons/CometQuasher.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -85,7 +86,8 @@ namespace CalamityMod.Items.Weapons num79 *= num80; float num114 = num78; float num115 = num79 + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, 424 + Main.rand.Next(3), (int)((double)((float)item.damage * player.meleeDamage) * 0.75), knockback, player.whoAmI, 1f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114 * 0.75f, num115 * 0.75f, 424 + Main.rand.Next(3), (int)((double)((float)item.damage * player.meleeDamage) * 0.75), knockback, player.whoAmI, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; } } diff --git a/Items/Weapons/ConferenceCall.cs b/Items/Weapons/ConferenceCall.cs index bc1033bce6..e6cb82a9ad 100644 --- a/Items/Weapons/ConferenceCall.cs +++ b/Items/Weapons/ConferenceCall.cs @@ -54,9 +54,9 @@ namespace CalamityMod.Items.Weapons int num6 = Main.rand.Next(4, 6); for (int index = 0; index < num6; ++index) { - float SpeedX = speedX + (float) Main.rand.Next(-30, 31) * 0.05f; - float SpeedY = speedY + (float) Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); } float num72 = item.shootSpeed; Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); @@ -80,8 +80,7 @@ namespace CalamityMod.Items.Weapons } num78 *= num80; num79 *= num80; - int num107 = Main.rand.Next(4, 6); - for (int num108 = 0; num108 < num107; num108++) + for (int num108 = 0; num108 < num6; num108++) { vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); @@ -102,7 +101,7 @@ namespace CalamityMod.Items.Weapons num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/CosmicBolter.cs b/Items/Weapons/CosmicBolter.cs index 438bb3e5fc..ff26ae0bf7 100644 --- a/Items/Weapons/CosmicBolter.cs +++ b/Items/Weapons/CosmicBolter.cs @@ -6,46 +6,40 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; -//using TerrariaOverhaul; -namespace CalamityMod.Items.Weapons +namespace CalamityMod.Items.Weapons { public class CosmicBolter : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Cosmic Bolter"); - } - - public override void SetDefaults() - { - item.damage = 60; - item.ranged = true; - item.width = 40; - item.height = 76; - item.useTime = 19; - item.useAnimation = 19; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.75f; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.UseSound = SoundID.Item75; - item.autoReuse = true; - item.shoot = mod.ProjectileType("LunarBolt2"); - item.shootSpeed = 10f; - item.useAmmo = 40; - } + } - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override void SetDefaults() { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; + item.damage = 70; + item.ranged = true; + item.width = 40; + item.height = 76; + item.useTime = 19; + item.useAnimation = 19; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.75f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item75; + item.autoReuse = true; + item.shoot = mod.ProjectileType("LunarBolt2"); + item.shootSpeed = 10f; + item.useAmmo = 40; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; int num118 = 2; Vector2 vector7 = new Vector2(speedX, speedY); vector7.Normalize(); @@ -64,17 +58,17 @@ namespace CalamityMod.Items.Weapons } return false; } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "LunarianBow"); - recipe.AddIngredient(null, "LivingShard", 5); - recipe.AddIngredient(ItemID.HallowedBar, 5); - recipe.AddIngredient(ItemID.SoulofSight, 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "LunarianBow"); + recipe.AddIngredient(null, "LivingShard", 5); + recipe.AddIngredient(ItemID.HallowedBar, 5); + recipe.AddIngredient(ItemID.SoulofSight, 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } \ No newline at end of file diff --git a/Items/Weapons/Crabulon/HyphaeRod.cs b/Items/Weapons/Crabulon/HyphaeRod.cs index 058affaa7b..f727f95c3f 100644 --- a/Items/Weapons/Crabulon/HyphaeRod.cs +++ b/Items/Weapons/Crabulon/HyphaeRod.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons.Crabulon { @@ -87,7 +88,8 @@ namespace CalamityMod.Items.Weapons.Crabulon num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-180, 181) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, i, 0f, (float)Main.rand.Next(3)); + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, i, 0f, (float)Main.rand.Next(3)); + Main.projectile[proj].GetGlobalProjectile(mod).forceMagic = true; } return false; } diff --git a/Items/Weapons/Crimsaber.cs b/Items/Weapons/Crimsaber.cs deleted file mode 100644 index a1a83e53cc..0000000000 --- a/Items/Weapons/Crimsaber.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Items; - -namespace CalamityMod.Items.Weapons -{ - public class Crimsaber : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Crimsaber"); - Tooltip.SetDefault("A sword fused with the blood of the gods"); - } - - public override void SetDefaults() - { - item.damage = 54; - item.melee = true; - item.width = 56; - item.height = 70; - item.useTime = 35; - item.useAnimation = 25; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 7; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.shootSpeed = 8f; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.CrimtaneBar, 20); - recipe.AddIngredient(ItemID.SoulofNight, 5); - recipe.AddIngredient(ItemID.Ichor, 5); - recipe.AddTile(TileID.DemonAltar); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Ichor, 60); - if (target.type == NPCID.TargetDummy || target.type == NPCID.TheDestroyerBody) - { - return; - } - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX - Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY - Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 *= num80; - num79 *= num80; - int num107 = 4; - for (int num108 = 0; num108 < num107; num108++) - { - vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); - vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - vector2.Y -= (float)(100 * num108); - num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (num79 < 0f) - { - num79 *= -1f; - } - if (num79 < 20f) - { - num79 = 20f; - } - num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - num80 = num72 / num80; - num78 *= num80; - num79 *= num80; - float speedX4 = num78; - float speedY5 = num79 + (float)Main.rand.Next(-180, 181) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, ProjectileID.GoldenShowerFriendly, (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 1f, (float)Main.rand.Next(10)); - } - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(5) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); - } - } - } -} \ No newline at end of file diff --git a/Items/Weapons/Crimsaber.png b/Items/Weapons/Crimsaber.png deleted file mode 100644 index b9316ac7a8..0000000000 Binary files a/Items/Weapons/Crimsaber.png and /dev/null differ diff --git a/Items/Weapons/Cryogen/GlacialCrusher.cs b/Items/Weapons/Cryogen/GlacialCrusher.cs index c71f90d9ac..7c375b6a5b 100644 --- a/Items/Weapons/Cryogen/GlacialCrusher.cs +++ b/Items/Weapons/Cryogen/GlacialCrusher.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.NPCs; namespace CalamityMod.Items.Weapons.Cryogen { @@ -13,7 +14,11 @@ namespace CalamityMod.Items.Weapons.Cryogen public override void SetStaticDefaults() { DisplayName.SetDefault("Glacial Crusher"); - } + Tooltip.SetDefault("Fires very slow frost projectiles that gain strength as they travel and freeze enemies\n" + + "Enemies are frozen for longer the further the projectile travels\n" + + "True melee strikes cause tremendous damage to frozen enemies\n" + + "Enemies that cannot be frozen take increased damage"); + } public override void SetDefaults() { @@ -24,14 +29,14 @@ namespace CalamityMod.Items.Weapons.Cryogen item.useTime = 27; item.useTurn = true; item.useStyle = 1; - item.knockBack = 6.5f; + item.knockBack = 5f; item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 58; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; item.shoot = mod.ProjectileType("Iceberg"); - item.shootSpeed = 12f; + item.shootSpeed = 3f; } public override void AddRecipes() @@ -51,9 +56,18 @@ namespace CalamityMod.Items.Weapons.Cryogen } } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - } + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { + if (target.buffImmune[mod.BuffType("GlacialState")]) + { + damage *= 2; + knockBack *= 2f; + } + else if (target.GetGlobalNPC(mod).gState) + { + damage *= 3; + knockBack *= 3f; + } + } } } diff --git a/Items/Weapons/CrystalFlareStaff.png b/Items/Weapons/CrystalFlareStaff.png index 7bbc4fbc96..6ce9c83227 100644 Binary files a/Items/Weapons/CrystalFlareStaff.png and b/Items/Weapons/CrystalFlareStaff.png differ diff --git a/Items/Weapons/CursedCapper.cs b/Items/Weapons/CursedCapper.cs index 1d8b219746..6dd3287daf 100644 --- a/Items/Weapons/CursedCapper.cs +++ b/Items/Weapons/CursedCapper.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("CursedRound"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("CursedRound"), damage, knockBack, player.whoAmI, 0f, 0f); return false; } diff --git a/Items/Weapons/DesertScourge/SeaboundStaff.cs b/Items/Weapons/DesertScourge/SeaboundStaff.cs index 3f742120f8..d886cd5de3 100644 --- a/Items/Weapons/DesertScourge/SeaboundStaff.cs +++ b/Items/Weapons/DesertScourge/SeaboundStaff.cs @@ -43,37 +43,31 @@ namespace CalamityMod.Items.Weapons.DesertScourge item.shootSpeed = 10f; item.summon = 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) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); - Vector2 vector3 = Main.MouseWorld - vector2; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("BrittleStar"), damage, knockBack, player.whoAmI, 0f, 0f); return false; - } + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } } } \ No newline at end of file diff --git a/Items/Weapons/DevourerofGods/Excelsus.cs b/Items/Weapons/DevourerofGods/Excelsus.cs index 12639229af..4b2313a591 100644 --- a/Items/Weapons/DevourerofGods/Excelsus.cs +++ b/Items/Weapons/DevourerofGods/Excelsus.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.DevourerofGods type = mod.ProjectileType("ExcelsusPink"); break; } - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs b/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs index 7dcb86e300..6010a75192 100644 --- a/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs +++ b/Items/Weapons/DevourerofGods/StaffoftheMechworm.cs @@ -31,8 +31,8 @@ namespace CalamityMod.Items.Weapons.DevourerofGods item.mana = 15; item.width = 58; item.height = 58; - item.useTime = 36; - item.useAnimation = 36; + item.useTime = 12; + item.useAnimation = 12; item.useStyle = 1; item.noMelee = true; item.knockBack = 2f; diff --git a/Items/Weapons/DraedonsExoblade.cs b/Items/Weapons/DraedonsExoblade.cs index f240cbda34..0d8ab0925e 100644 --- a/Items/Weapons/DraedonsExoblade.cs +++ b/Items/Weapons/DraedonsExoblade.cs @@ -126,7 +126,6 @@ namespace CalamityMod.Items.Weapons recipe.AddIngredient(null, "FlarefrostBlade"); recipe.AddIngredient(null, "PhoenixBlade"); recipe.AddIngredient(null, "StellarStriker"); - recipe.AddIngredient(null, "Terracotta"); recipe.AddIngredient(null, "NightmareFuel", 5); recipe.AddIngredient(null, "EndothermicEnergy", 5); recipe.AddIngredient(null, "CosmiliteBar", 5); diff --git a/Items/Weapons/EarthenPike.cs b/Items/Weapons/EarthenPike.cs index c15eb83de7..dbf81f1636 100644 --- a/Items/Weapons/EarthenPike.cs +++ b/Items/Weapons/EarthenPike.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons item.useAnimation = 25; item.useStyle = 5; item.useTime = 25; - item.knockBack = 7; + item.knockBack = 7f; item.UseSound = SoundID.Item1; item.autoReuse = false; item.height = 60; diff --git a/Items/Weapons/EmpyreanKnives.png b/Items/Weapons/EmpyreanKnives.png index 15b3e46fbc..23985d4fdc 100644 Binary files a/Items/Weapons/EmpyreanKnives.png and b/Items/Weapons/EmpyreanKnives.png differ diff --git a/Items/Weapons/FellerofEvergreens.png b/Items/Weapons/FellerofEvergreens.png index df8c3ff448..0c51f191c2 100644 Binary files a/Items/Weapons/FellerofEvergreens.png and b/Items/Weapons/FellerofEvergreens.png differ diff --git a/Items/Weapons/Floodtide.cs b/Items/Weapons/Floodtide.cs index b117ebdbf9..dc34dd079d 100644 --- a/Items/Weapons/Floodtide.cs +++ b/Items/Weapons/Floodtide.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -38,8 +39,9 @@ namespace CalamityMod.Items.Weapons 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 1f, 0.0f); - return false; + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + return false; } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/FulgurationHalberd.cs b/Items/Weapons/FulgurationHalberd.cs index 21ad81ad92..a1d3831ab2 100644 --- a/Items/Weapons/FulgurationHalberd.cs +++ b/Items/Weapons/FulgurationHalberd.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Fulguration Halberd"); + Tooltip.SetDefault("Inflicts burning blood on enemy hits\n" + + "Right click to change modes"); } public override void SetDefaults() @@ -25,14 +27,54 @@ namespace CalamityMod.Items.Weapons item.useStyle = 1; item.useTime = 22; item.useTurn = true; - item.knockBack = 4.5f; + item.knockBack = 5f; item.UseSound = SoundID.Item1; item.autoReuse = true; item.height = 62; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; + item.shoot = mod.ProjectileType("NobodyKnows"); + item.shootSpeed = 6f; } - + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + item.noMelee = true; + item.noUseGraphic = true; + item.useStyle = 5; + item.autoReuse = false; + } + else + { + item.noMelee = false; + item.noUseGraphic = false; + item.useStyle = 1; + item.autoReuse = true; + } + return base.CanUseItem(player); + } + + 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) + { + if (player.altFunctionUse == 2) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("FulgurationHalberd"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("BurningBlood"), 300); + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs b/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs index 8e3fe6f252..236f60f623 100644 --- a/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs +++ b/Items/Weapons/GreatSandShark/SandSharknadoStaff.cs @@ -42,40 +42,34 @@ namespace CalamityMod.Items.Weapons.GreatSandShark item.shootSpeed = 10f; item.summon = 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) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - Vector2 value = Vector2.UnitX.RotatedBy((double)player.fullRotation, default(Vector2)); - Vector2 vector3 = Main.MouseWorld - vector2; - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, type, damage, knockBack, player.whoAmI, 0f, 0f); - return false; - } - public override void AddRecipes() + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.TempestStaff); diff --git a/Items/Weapons/Helstorm.cs b/Items/Weapons/Helstorm.cs index 27e387359b..6936fee045 100644 --- a/Items/Weapons/Helstorm.cs +++ b/Items/Weapons/Helstorm.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Items.Weapons { item.damage = 21; item.ranged = true; - item.width = 70; - item.height = 36; + item.width = 50; + item.height = 24; item.useTime = 7; item.useAnimation = 7; item.useStyle = 5; @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons float num8 = speedY; float SpeedX = speedX + (float) Main.rand.Next(-10, 11) * 0.05f; float SpeedY = speedY + (float) Main.rand.Next(-10, 11) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/HiveMind/DankStaff.cs b/Items/Weapons/HiveMind/DankStaff.cs index c8762f628c..667856633b 100644 --- a/Items/Weapons/HiveMind/DankStaff.cs +++ b/Items/Weapons/HiveMind/DankStaff.cs @@ -54,35 +54,31 @@ namespace CalamityMod.Items.Weapons.HiveMind recipe.SetResult(this); recipe.AddRecipe(); } - - 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) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("DankCreeper"), damage, knockBack, player.whoAmI, 0f, 0f); return false; - } + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } } } \ No newline at end of file diff --git a/Items/Weapons/InfernaCutter.cs b/Items/Weapons/InfernaCutter.cs index e2740b7678..c59fd8e8e6 100644 --- a/Items/Weapons/InfernaCutter.cs +++ b/Items/Weapons/InfernaCutter.cs @@ -7,59 +7,128 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; -namespace CalamityMod.Items.Weapons +namespace CalamityMod.Items.Weapons { public class InfernaCutter : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Inferna Cutter"); - } - - public override void SetDefaults() - { - item.damage = 85; - item.melee = true; - item.width = 60; - item.height = 46; - item.useTime = 16; - item.useAnimation = 16; - item.useTurn = true; - item.axe = 27; - item.useStyle = 1; - item.knockBack = 7.75f; - item.value = Item.buyPrice(0, 36, 0, 0); - item.rare = 5; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PurityAxe"); - recipe.AddIngredient(ItemID.SoulofFright, 8); - recipe.AddIngredient(null, "EssenceofChaos", 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(4) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); - } - } - - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + Tooltip.SetDefault("Critical hits with the blade cause small explosions\n" + + "Generates a number of small sparks when swung"); + } + + public override void SetDefaults() { - target.AddBuff(BuffID.OnFire, 300); - if(Main.rand.Next(2) == 0) - { - target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); - } + item.damage = 85; + item.melee = true; + item.width = 60; + item.height = 46; + item.useTime = 16; + item.useAnimation = 16; + item.useTurn = true; + item.axe = 27; + item.useStyle = 1; + item.knockBack = 7f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PurityAxe"); + recipe.AddIngredient(ItemID.SoulofFright, 8); + recipe.AddIngredient(null, "EssenceofChaos", 3); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (player.whoAmI == Main.myPlayer) + { + if ((player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7) || + player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9))) + { + float num339 = 0f; + float num340 = 0f; + float num341 = 0f; + float num342 = 0f; + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) + { + num339 = -7f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num339 = -6f; + num340 = 2f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.5)) + { + num339 = -4f; + num340 = 4f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) + { + num339 = -2f; + num340 = 6f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) + { + num340 = 7f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num342 = 26f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.3)) + { + num342 -= 4f; + num341 -= 20f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.1)) + { + num341 += 6f; + } + if (player.direction == -1) + { + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.9)) + { + num342 -= 8f; + } + if (player.itemAnimation == (int)((double)player.itemAnimationMax * 0.7)) + { + num342 -= 6f; + } + } + num339 *= 1.5f; + num340 *= 1.5f; + num342 *= (float)player.direction; + num341 *= player.gravDir; + Projectile.NewProjectile((float)(hitbox.X + hitbox.Width / 2) + num342, (float)(hitbox.Y + hitbox.Height / 2) + num341, (float)player.direction * num340, num339 * player.gravDir, ProjectileID.Spark, (int)((float)item.damage * 0.1f * player.meleeDamage), 0f, player.whoAmI, 0f, 0f); + } + } + if (Main.rand.Next(4) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 6); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (crit) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, 612, (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); } } } \ No newline at end of file diff --git a/Items/Weapons/InfernalRift.png b/Items/Weapons/InfernalRift.png index 4ca112b75d..4798dd7c57 100644 Binary files a/Items/Weapons/InfernalRift.png and b/Items/Weapons/InfernalRift.png differ diff --git a/Items/Weapons/IonBlaster.png b/Items/Weapons/IonBlaster.png index fc9e66e340..b6b652cdb3 100644 Binary files a/Items/Weapons/IonBlaster.png and b/Items/Weapons/IonBlaster.png differ diff --git a/Items/Weapons/MagnaCannon.cs b/Items/Weapons/MagnaCannon.cs index 6d28568f36..1f222bfbb8 100644 --- a/Items/Weapons/MagnaCannon.cs +++ b/Items/Weapons/MagnaCannon.cs @@ -35,8 +35,13 @@ namespace CalamityMod.Items.Weapons item.shootSpeed = 12f; item.shoot = mod.ProjectileType("MagnaBlast"); } - - 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) + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + 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) { int num6 = 3; for (int index = 0; index < num6; ++index) diff --git a/Items/Weapons/MandibleBow.png b/Items/Weapons/MandibleBow.png index 6f817a210c..b05ee95a83 100644 Binary files a/Items/Weapons/MandibleBow.png and b/Items/Weapons/MandibleBow.png differ diff --git a/Items/Weapons/Mariana.cs b/Items/Weapons/Mariana.cs index a67dfccdf0..13fdbc5ccc 100644 --- a/Items/Weapons/Mariana.cs +++ b/Items/Weapons/Mariana.cs @@ -7,19 +7,20 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; -namespace CalamityMod.Items.Weapons +namespace CalamityMod.Items.Weapons { public class Mariana : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Mariana"); - Tooltip.SetDefault("Tropical and deadly"); + Tooltip.SetDefault("Tropical and deadly\n" + + "Enemies explode into water orbs on death"); } public override void SetDefaults() { - item.damage = 75; + item.damage = 90; item.width = 54; item.height = 62; item.melee = true; @@ -30,49 +31,68 @@ namespace CalamityMod.Items.Weapons item.knockBack = 6.5f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.value = Item.buyPrice(0, 60, 0, 0); - item.rare = 7; - item.shoot = mod.ProjectileType("MarianaProjectile"); - item.shootSpeed = 16f; + item.value = Item.buyPrice(0, 60, 0, 0); + item.rare = 7; } - - 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) - { - float SpeedA = speedX; - float SpeedB = speedY; - int num6 = Main.rand.Next(4, 6); - for (int index = 0; index < num6; ++index) - { - float num7 = speedX; - float num8 = speedY; - 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, (int)((double)damage * 0.5f), knockBack, player.whoAmI, 0.0f, 0.0f); - } - return false; - } - + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.ChlorophyteClaymore); - recipe.AddIngredient(ItemID.Coral, 3); - recipe.AddIngredient(ItemID.Starfish, 3); - recipe.AddIngredient(ItemID.Seashell, 3); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); + recipe.AddIngredient(ItemID.Coral, 3); + recipe.AddIngredient(ItemID.Starfish, 3); + recipe.AddIngredient(ItemID.Seashell, 3); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); } - + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + int num251 = Main.rand.Next(4, 6); + for (int num252 = 0; num252 < num251; 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(target.Center.X, target.Center.Y, value15.X, value15.Y, mod.ProjectileType("MarianaProjectile"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, 0f); + } + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 59, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + public override void MeleeEffects(Player player, Rectangle hitbox) - { - if(Main.rand.Next(3) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 59); - } - } + { + if (Main.rand.Next(3) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 59); + } + } } } diff --git a/Items/Weapons/MineralMortar.png b/Items/Weapons/MineralMortar.png index acb111dcea..024d861e74 100644 Binary files a/Items/Weapons/MineralMortar.png and b/Items/Weapons/MineralMortar.png differ diff --git a/Items/Weapons/MirrorBlade.cs b/Items/Weapons/MirrorBlade.cs index f08e08c244..6471ea8d3b 100644 --- a/Items/Weapons/MirrorBlade.cs +++ b/Items/Weapons/MirrorBlade.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { - item.width = 50; + item.width = 52; item.damage = 236; item.melee = true; item.mana = 4; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons item.knockBack = 8f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 60; + item.height = 62; item.value = Item.buyPrice(1, 40, 0, 0); item.rare = 10; item.shootSpeed = 16f; diff --git a/Items/Weapons/MirrorBlade.png b/Items/Weapons/MirrorBlade.png index 27bfa9882f..3724a948ab 100644 Binary files a/Items/Weapons/MirrorBlade.png and b/Items/Weapons/MirrorBlade.png differ diff --git a/Items/Weapons/Monsoon.cs b/Items/Weapons/Monsoon.cs index 30ad23f2e7..e1825a1184 100644 --- a/Items/Weapons/Monsoon.cs +++ b/Items/Weapons/Monsoon.cs @@ -6,46 +6,41 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; -//using TerrariaOverhaul; +using CalamityMod.Projectiles; -namespace CalamityMod.Items.Weapons +namespace CalamityMod.Items.Weapons { public class Monsoon : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Monsoon"); - } - - public override void SetDefaults() - { - item.damage = 63; - item.ranged = true; - item.width = 30; - item.height = 62; - item.useTime = 21; - item.useAnimation = 21; - item.useStyle = 5; - item.noMelee = true; - item.knockBack = 2.5f; - item.value = Item.buyPrice(0, 95, 0, 0); - item.rare = 9; - item.UseSound = SoundID.Item5; - item.autoReuse = true; - item.shoot = 1; - item.shootSpeed = 10f; - item.useAmmo = 40; - } + } - /*public void OverhaulInit() - { - this.SetTag("bow"); - }*/ - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + public override void SetDefaults() { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num117 = 0.314159274f; + item.damage = 63; + item.ranged = true; + item.width = 30; + item.height = 62; + item.useTime = 21; + item.useAnimation = 21; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2.5f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 1; + item.shootSpeed = 10f; + item.useAmmo = 40; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num117 = 0.314159274f; int num118 = 5; Vector2 vector7 = new Vector2(speedX, speedY); vector7.Normalize(); @@ -59,40 +54,41 @@ namespace CalamityMod.Items.Weapons { value9 -= vector7; } - if (type == ProjectileID.WoodenArrowFriendly) - { - if (Main.rand.Next(12) == 0) - { - type = 408; - } - if (Main.rand.Next(25) == 0) - { - type = mod.ProjectileType("TyphoonArrow"); - } - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, (type == 408 ? 2f : 0.0f), 0.0f); - Main.projectile[num121].noDropItem = true; - } - else - { - int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[num121].noDropItem = true; - } + if (type == ProjectileID.WoodenArrowFriendly) + { + if (Main.rand.Next(12) == 0) + { + type = 408; + } + if (Main.rand.Next(25) == 0) + { + type = mod.ProjectileType("TyphoonArrow"); + } + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[num121].noDropItem = true; + } + else + { + int num121 = Projectile.NewProjectile(vector2.X + value9.X, vector2.Y + value9.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[num121].noDropItem = true; + } } return false; - } - - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.FragmentVortex, 15); - recipe.AddIngredient(ItemID.Tsunami); - recipe.AddIngredient(ItemID.SharkFin, 2); - recipe.AddIngredient(null, "DepthCells", 10); - recipe.AddIngredient(null, "Lumenite", 10); - recipe.AddIngredient(null, "Tenebris", 5); - recipe.AddTile(TileID.LunarCraftingStation); - recipe.SetResult(this); - recipe.AddRecipe(); - } + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.FragmentVortex, 15); + recipe.AddIngredient(ItemID.Tsunami); + recipe.AddIngredient(ItemID.SharkFin, 2); + recipe.AddIngredient(null, "DepthCells", 10); + recipe.AddIngredient(null, "Lumenite", 10); + recipe.AddIngredient(null, "Tenebris", 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } } } \ No newline at end of file diff --git a/Items/Weapons/Monsoon.png b/Items/Weapons/Monsoon.png index d2b3323594..68882568e7 100644 Binary files a/Items/Weapons/Monsoon.png and b/Items/Weapons/Monsoon.png differ diff --git a/Items/Weapons/NullificationRifle.cs b/Items/Weapons/NullificationRifle.cs index 7129137166..ba57b22a58 100644 --- a/Items/Weapons/NullificationRifle.cs +++ b/Items/Weapons/NullificationRifle.cs @@ -44,6 +44,10 @@ namespace CalamityMod.Items.Weapons 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) { player.statLife -= 5; + if (Main.myPlayer == player.whoAmI) + { + player.HealEffect(-5, true); + } if (player.statLife <= 0) { player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); diff --git a/Items/Weapons/Omniblade.cs b/Items/Weapons/Omniblade.cs index b7cbfbc49e..a97a329098 100644 --- a/Items/Weapons/Omniblade.cs +++ b/Items/Weapons/Omniblade.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { - item.width = 100; + item.width = 64; item.damage = 63; item.crit += 45; item.melee = true; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons item.knockBack = 6f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 120; + item.height = 146; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; } diff --git a/Items/Weapons/Omniblade.png b/Items/Weapons/Omniblade.png index 61e71568dc..53936276b5 100644 Binary files a/Items/Weapons/Omniblade.png and b/Items/Weapons/Omniblade.png differ diff --git a/Items/Weapons/Perforators/BloodClotStaff.cs b/Items/Weapons/Perforators/BloodClotStaff.cs index d9a0fc6a9a..50463681d7 100644 --- a/Items/Weapons/Perforators/BloodClotStaff.cs +++ b/Items/Weapons/Perforators/BloodClotStaff.cs @@ -53,35 +53,31 @@ namespace CalamityMod.Items.Weapons.Perforators recipe.SetResult(this); recipe.AddRecipe(); } - - 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) - { - float num72 = item.shootSpeed; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) + + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("BloodClotMinion"), damage, knockBack, player.whoAmI, 0f, 0f); return false; - } + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } } } \ No newline at end of file diff --git a/Items/Weapons/PlagueKeeper.cs b/Items/Weapons/PlagueKeeper.cs index 5e9bf7cd51..5c95e9a40e 100644 --- a/Items/Weapons/PlagueKeeper.cs +++ b/Items/Weapons/PlagueKeeper.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -56,7 +57,8 @@ namespace CalamityMod.Items.Weapons int bee = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, player.beeType(), player.beeDamage(item.damage / 3), player.beeKB(0f), player.whoAmI, 0f, 0f); Main.projectile[bee].penetrate = 1; - } + Main.projectile[bee].GetGlobalProjectile(mod).forceMelee = true; + } } } } diff --git a/Items/Weapons/Providence/TelluricGlare.cs b/Items/Weapons/Providence/TelluricGlare.cs index c2522e6c96..f2621c062b 100644 --- a/Items/Weapons/Providence/TelluricGlare.cs +++ b/Items/Weapons/Providence/TelluricGlare.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Providence public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("TelluricGlare"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("TelluricGlare"), damage, knockBack, player.whoAmI, 0f, 0f); return false; } } diff --git a/Items/Weapons/PurityAxe.cs b/Items/Weapons/PurityAxe.cs index 57e1757733..4af30915c8 100644 --- a/Items/Weapons/PurityAxe.cs +++ b/Items/Weapons/PurityAxe.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Axe of Purity"); + Tooltip.SetDefault("Cleanses the evil"); } public override void SetDefaults() @@ -27,18 +28,21 @@ namespace CalamityMod.Items.Weapons item.useTurn = true; item.axe = 25; item.useStyle = 1; - item.knockBack = 7.5f; + item.knockBack = 5f; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; item.UseSound = SoundID.Item1; item.autoReuse = true; - } + item.shoot = ProjectileID.PurificationPowder; + item.shootSpeed = 12f; + } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "FellerofEvergreens"); - recipe.AddIngredient(ItemID.PixieDust, 10); + recipe.AddIngredient(ItemID.PurificationPowder, 20); + recipe.AddIngredient(ItemID.PixieDust, 10); recipe.AddIngredient(ItemID.CrystalShard, 5); recipe.AddTile(TileID.Anvils); recipe.SetResult(this); diff --git a/Items/Weapons/Quagmire.cs b/Items/Weapons/Quagmire.cs index 36863f0035..6e58fba655 100644 --- a/Items/Weapons/Quagmire.cs +++ b/Items/Weapons/Quagmire.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { item.CloneDefaults(ItemID.HelFire); - item.damage = 43; + item.damage = 52; item.useTime = 22; item.useAnimation = 22; item.useStyle = 5; diff --git a/Items/Weapons/RareVariants/Arbalest.cs b/Items/Weapons/RareVariants/Arbalest.cs new file mode 100644 index 0000000000..46c404471e --- /dev/null +++ b/Items/Weapons/RareVariants/Arbalest.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class Arbalest : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Arbalest"); + Tooltip.SetDefault("Fires volleys of high-speed arrows"); + } + + public override void SetDefaults() + { + item.damage = 25; + item.ranged = true; + item.crit += 20; + item.width = 58; + item.height = 22; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 10f; + item.useAmmo = 40; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + 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) + { + for (int i = 0; i < 3; i++) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; + int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].extraUpdates += i; + Main.projectile[proj].noDropItem = true; + } + return false; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RareVariants/Arbalest.png b/Items/Weapons/RareVariants/Arbalest.png new file mode 100644 index 0000000000..bd22a163e4 Binary files /dev/null and b/Items/Weapons/RareVariants/Arbalest.png differ diff --git a/Items/Weapons/RareVariants/Carnage.cs b/Items/Weapons/RareVariants/Carnage.cs new file mode 100644 index 0000000000..7ac63b1307 --- /dev/null +++ b/Items/Weapons/RareVariants/Carnage.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class Carnage : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Carnage"); + Tooltip.SetDefault("Enemies explode into homing blood on death"); + } + + public override void SetDefaults() + { + item.width = 46; + item.damage = 55; + item.melee = true; + item.useAnimation = 21; + item.useStyle = 1; + item.useTime = 21; + item.knockBack = 5.25f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.useTurn = true; + item.height = 60; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(3) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 5); + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (target.life <= 0) + { + Main.PlaySound(2, (int)target.position.X, (int)target.position.Y, 74); + target.position.X = target.position.X + (float)(target.width / 2); + target.position.Y = target.position.Y + (float)(target.height / 2); + target.position.X = target.position.X - (float)(target.width / 2); + target.position.Y = target.position.Y - (float)(target.height / 2); + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 25; num623++) + { + int num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, 5, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + int num251 = Main.rand.Next(4, 6); + for (int num252 = 0; num252 < num251; 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(target.Center.X, target.Center.Y, value15.X, value15.Y, mod.ProjectileType("Blood"), (int)((float)item.damage * player.meleeDamage), knockback, player.whoAmI, 0f, 0f); + } + } + } + } +} diff --git a/Items/Weapons/RareVariants/Carnage.png b/Items/Weapons/RareVariants/Carnage.png new file mode 100644 index 0000000000..cfa055f371 Binary files /dev/null and b/Items/Weapons/RareVariants/Carnage.png differ diff --git a/Items/Weapons/RareVariants/ClothiersWrath.cs b/Items/Weapons/RareVariants/ClothiersWrath.cs new file mode 100644 index 0000000000..4cf8f477ab --- /dev/null +++ b/Items/Weapons/RareVariants/ClothiersWrath.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; +using CalamityMod.Projectiles; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class ClothiersWrath : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Clothier's Wrath"); + } + + public override void SetDefaults() + { + item.damage = 24; + item.magic = true; + item.mana = 15; + item.width = 28; + item.height = 30; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 4, 0, 0); + item.rare = 3; + item.UseSound = SoundID.Item8; + item.autoReuse = true; + item.shoot = ProjectileID.ClothiersCurse; + item.shootSpeed = 6f; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + 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 numProj = 2; + float rotation = MathHelper.ToRadians(2); + for (int i = 0; i < numProj + 1; i++) + { + Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + int proj = Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMagic = true; + } + return false; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RareVariants/ClothiersWrath.png b/Items/Weapons/RareVariants/ClothiersWrath.png new file mode 100644 index 0000000000..72782f6b46 Binary files /dev/null and b/Items/Weapons/RareVariants/ClothiersWrath.png differ diff --git a/Items/Weapons/RareVariants/Cryophobia.cs b/Items/Weapons/RareVariants/Cryophobia.cs new file mode 100644 index 0000000000..69af187671 --- /dev/null +++ b/Items/Weapons/RareVariants/Cryophobia.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class Cryophobia : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cryophobia"); + Tooltip.SetDefault("Chill"); + } + + public override void SetDefaults() + { + item.damage = 24; + item.magic = true; + item.mana = 18; + item.width = 56; + item.height = 34; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1.5f; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.UseSound = SoundID.Item117; + item.autoReuse = true; + item.shootSpeed = 12f; + item.shoot = mod.ProjectileType("CryoBlast"); + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RareVariants/Cryophobia.png b/Items/Weapons/RareVariants/Cryophobia.png new file mode 100644 index 0000000000..16ff1da64a Binary files /dev/null and b/Items/Weapons/RareVariants/Cryophobia.png differ diff --git a/Items/Weapons/RareVariants/EvilSmasher.cs b/Items/Weapons/RareVariants/EvilSmasher.cs new file mode 100644 index 0000000000..27ff17e6af --- /dev/null +++ b/Items/Weapons/RareVariants/EvilSmasher.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class EvilSmasher : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Evil Smasher"); + Tooltip.SetDefault("EViL! sMaSH eVIl! SmAsh...ER!"); + } + + public override void SetDefaults() + { + item.width = 62; + item.damage = 55; + item.melee = true; + item.useAnimation = 30; + item.useStyle = 1; + item.useTime = 30; + item.useTurn = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 62; + item.value = Item.buyPrice(0, 36, 0, 0); + item.rare = 5; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("FossilSpike"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + if (Main.rand.Next(3) == 0) + { + item.damage = 82; + item.useAnimation = 15; + item.useTime = 15; + item.knockBack = 14f; + } + else + { + item.damage = 55; + item.useAnimation = 30; + item.useTime = 30; + item.knockBack = 8f; + } + } + } +} diff --git a/Items/Weapons/RareVariants/EvilSmasher.png b/Items/Weapons/RareVariants/EvilSmasher.png new file mode 100644 index 0000000000..e5dfebb9b0 Binary files /dev/null and b/Items/Weapons/RareVariants/EvilSmasher.png differ diff --git a/Items/Weapons/RareVariants/EyeofMagnus.cs b/Items/Weapons/RareVariants/EyeofMagnus.cs new file mode 100644 index 0000000000..59e2ec9023 --- /dev/null +++ b/Items/Weapons/RareVariants/EyeofMagnus.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class EyeofMagnus : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eye of Magnus"); + Tooltip.SetDefault("Fires powerful beams\n" + + "Heals mana and health on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 80; + item.damage = 55; + item.rare = 5; + item.useAnimation = 20; + item.useTime = 20; + item.useStyle = 5; + item.knockBack = 2f; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); + item.magic = true; + item.mana = 7; + item.autoReuse = true; + item.noMelee = true; + item.height = 50; + item.value = Item.buyPrice(0, 36, 0, 0); + item.shoot = mod.ProjectileType("MagnusBeam"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-15, 0); + } + } +} diff --git a/Items/Weapons/RareVariants/EyeofMagnus.png b/Items/Weapons/RareVariants/EyeofMagnus.png new file mode 100644 index 0000000000..e54e7dc789 Binary files /dev/null and b/Items/Weapons/RareVariants/EyeofMagnus.png differ diff --git a/Items/Weapons/RareVariants/GrandDad.cs b/Items/Weapons/RareVariants/GrandDad.cs new file mode 100644 index 0000000000..2e75502dba --- /dev/null +++ b/Items/Weapons/RareVariants/GrandDad.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class GrandDad : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Grand Dad"); + Tooltip.SetDefault("Lowers enemy defense to 0 when they are struck\n" + + "Yeets enemies across space and time\n" + + "7"); + } + + public override void SetDefaults() + { + item.width = 124; + item.damage = 777; + item.melee = true; + item.useAnimation = 25; + item.useStyle = 1; + item.useTime = 25; + item.useTurn = true; + item.knockBack = 77f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 124; + item.value = Item.buyPrice(1, 0, 0, 0); + item.rare = 10; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (!target.boss) + { + target.knockBackResist = 7f; + target.defense = 0; + } + } + } +} diff --git a/Items/Weapons/RareVariants/GrandDad.png b/Items/Weapons/RareVariants/GrandDad.png new file mode 100644 index 0000000000..4d7d9bdf12 Binary files /dev/null and b/Items/Weapons/RareVariants/GrandDad.png differ diff --git a/Items/Weapons/RareVariants/Hellborn.cs b/Items/Weapons/RareVariants/Hellborn.cs new file mode 100644 index 0000000000..c661d1178b --- /dev/null +++ b/Items/Weapons/RareVariants/Hellborn.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class Hellborn : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hellborn"); + Tooltip.SetDefault("Converts all bullets to explosive rounds\n" + + "Enemies that touch the gun while it's being fired take massive damage"); + } + + public override void SetDefaults() + { + item.damage = 21; + item.ranged = true; + item.width = 50; + item.height = 24; + item.useTime = 9; + item.useAnimation = 9; + item.useStyle = 5; + item.knockBack = 1f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item11; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 14f; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + 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) + { + for (int index = 0; index < 3; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float) Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, ProjectileID.ExplosiveBullet, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit) + { + damage *= 15; + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.OnFire, 400); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RareVariants/Hellborn.png b/Items/Weapons/RareVariants/Hellborn.png new file mode 100644 index 0000000000..b64c8d5a53 Binary files /dev/null and b/Items/Weapons/RareVariants/Hellborn.png differ diff --git a/Items/Weapons/RareVariants/Infinity.cs b/Items/Weapons/RareVariants/Infinity.cs new file mode 100644 index 0000000000..4a961637ce --- /dev/null +++ b/Items/Weapons/RareVariants/Infinity.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class Infinity : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Infinity"); + Tooltip.SetDefault("Bad PC\n" + + "Fires a barrage of energy bolts that split and bounce\n" + + "Right click to fire a barrage of normal bullets"); + } + + public override void SetDefaults() + { + item.damage = 30; + item.ranged = true; + item.width = 56; + item.height = 24; + item.useTime = 2; + item.reuseDelay = 6; + item.useAnimation = 18000; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 1f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item31; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + public override bool AltFunctionUse(Player player) + { + return 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) + { + int bulletAmt = 2; + if (player.altFunctionUse == 2) + { + for (int index = 0; index < bulletAmt; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float) Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-15, 16) * 0.05f; + int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[shot].timeLeft = 180; + } + return false; + } + else + { + for (int index = 0; index < bulletAmt; ++index) + { + float num7 = speedX; + float num8 = speedY; + float SpeedX = speedX + (float) Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float) Main.rand.Next(-15, 16) * 0.05f; + int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("ChargedBlast"), damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[shot].timeLeft = 180; + } + return false; + } + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RareVariants/Infinity.png b/Items/Weapons/RareVariants/Infinity.png new file mode 100644 index 0000000000..3623844b82 Binary files /dev/null and b/Items/Weapons/RareVariants/Infinity.png differ diff --git a/Items/Weapons/RareVariants/LeadWizard.cs b/Items/Weapons/RareVariants/LeadWizard.cs new file mode 100644 index 0000000000..85bbf10e3e --- /dev/null +++ b/Items/Weapons/RareVariants/LeadWizard.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class LeadWizard : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lead Wizard"); + Tooltip.SetDefault("Something's not right...\n" + + "33% chance to not consume ammo"); + } + + public override void SetDefaults() + { + item.damage = 88; + item.ranged = true; + item.width = 66; + item.height = 34; + item.useTime = 2; + item.reuseDelay = 10; + item.useAnimation = 6; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 5f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item31; + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 20f; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + 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) + { + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + SpeedX += speedY + (float)Main.rand.Next(-85, 86) * 0.05f; + SpeedY += speedX + (float)Main.rand.Next(-85, 86) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, 242, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + + public override bool ConsumeAmmo(Player player) + { + if (Main.rand.Next(0, 100) < 33) + return false; + return true; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RareVariants/LeadWizard.png b/Items/Weapons/RareVariants/LeadWizard.png new file mode 100644 index 0000000000..b3ec232734 Binary files /dev/null and b/Items/Weapons/RareVariants/LeadWizard.png differ diff --git a/Items/Weapons/RareVariants/Norfleet.cs b/Items/Weapons/RareVariants/Norfleet.cs new file mode 100644 index 0000000000..66d84d95bb --- /dev/null +++ b/Items/Weapons/RareVariants/Norfleet.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class Norfleet : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Norfleet"); + } + + public override void SetDefaults() + { + item.damage = 1280; + item.knockBack = 15f; + item.shootSpeed = 30f; + item.useStyle = 5; + item.useAnimation = 75; + item.useTime = 75; + item.reuseDelay = 0; + item.width = 140; + item.height = 42; + item.UseSound = SoundID.Item92; + item.shoot = mod.ProjectileType("Norfleet"); + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.noMelee = true; + item.noUseGraphic = true; + item.ranged = true; + item.channel = true; + item.useTurn = false; + item.useAmmo = 75; + item.autoReuse = true; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Norfleet"), 0, 0f, player.whoAmI); + return false; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RareVariants/Norfleet.png b/Items/Weapons/RareVariants/Norfleet.png new file mode 100644 index 0000000000..c38fd3b142 Binary files /dev/null and b/Items/Weapons/RareVariants/Norfleet.png differ diff --git a/Items/Weapons/RareVariants/PearlGod.cs b/Items/Weapons/RareVariants/PearlGod.cs new file mode 100644 index 0000000000..0ce9e6f38f --- /dev/null +++ b/Items/Weapons/RareVariants/PearlGod.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class PearlGod : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Pearl God"); + Tooltip.SetDefault("Your life is mine..."); + } + + public override void SetDefaults() + { + item.damage = 40; + item.ranged = true; + item.width = 50; + item.height = 32; + item.useTime = 12; + item.useAnimation = 12; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item41; + item.autoReuse = true; + item.shootSpeed = 24f; + item.shoot = mod.ProjectileType("ShockblastRound"); + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + + 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) + { + for (int index = 0; index < 2; ++index) + { + float speedMult = (float)(index + 1) * 0.15f; + Projectile.NewProjectile(position.X, position.Y, speedX * speedMult, speedY * speedMult, mod.ProjectileType("FrostsparkBullet"), (int)((double)damage * 0.5), knockBack, player.whoAmI, 0.0f, 0.0f); + } + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ShockblastRound"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + return false; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RareVariants/PearlGod.png b/Items/Weapons/RareVariants/PearlGod.png new file mode 100644 index 0000000000..a3aee2e65c Binary files /dev/null and b/Items/Weapons/RareVariants/PearlGod.png differ diff --git a/Items/Weapons/RareVariants/Skullmasher.cs b/Items/Weapons/RareVariants/Skullmasher.cs new file mode 100644 index 0000000000..0c6e41f6e4 --- /dev/null +++ b/Items/Weapons/RareVariants/Skullmasher.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class Skullmasher : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Skullmasher"); + Tooltip.SetDefault("Sniper shotgun, because why not?\n" + + "If you crit the target a second swarm of bullets will fire near the target"); + } + + public override void SetDefaults() + { + item.damage = 2310; + item.ranged = true; + item.width = 76; + item.crit += 5; + item.height = 30; + item.useTime = 60; + item.useAnimation = 60; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + item.autoReuse = true; + item.shoot = 10; + item.shootSpeed = 12f; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + 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) + { + for (int index = 0; index < 5; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("AMR"), damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RareVariants/Skullmasher.png b/Items/Weapons/RareVariants/Skullmasher.png new file mode 100644 index 0000000000..34816cf6a2 Binary files /dev/null and b/Items/Weapons/RareVariants/Skullmasher.png differ diff --git a/Items/Weapons/RareVariants/Swordsplosion.cs b/Items/Weapons/RareVariants/Swordsplosion.cs new file mode 100644 index 0000000000..1d1d300af5 --- /dev/null +++ b/Items/Weapons/RareVariants/Swordsplosion.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class Swordsplosion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Swordsplosion"); + Tooltip.SetDefault("Sword swarm"); + } + + public override void SetDefaults() + { + item.width = 84; + item.damage = 60; + item.melee = true; + item.useAnimation = 30; + item.useTime = 30; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 15f; + item.UseSound = SoundID.Item60; + item.autoReuse = true; + item.height = 84; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.shoot = mod.ProjectileType("EonBeam"); + item.shootSpeed = 16f; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + switch (Main.rand.Next(4)) + { + case 0: type = mod.ProjectileType("EonBeam"); break; + case 1: type = mod.ProjectileType("EonBeamV2"); break; + case 2: type = mod.ProjectileType("EonBeamV3"); break; + case 3: type = mod.ProjectileType("EonBeamV4"); break; + } + float num72 = Main.rand.Next(22, 30); + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X + vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y + vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + int num107 = 16; + for (int num108 = 0; num108 < num107; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(-(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); + vector2.X = (vector2.X + player.Center.X) / 2f; + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-360, 361) * 0.02f; + float speedY5 = num79 + (float)Main.rand.Next(-360, 361) * 0.02f; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + return false; + } + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(5) == 0) + { + int num250 = Dust.NewDust(new Vector2((float)hitbox.X, (float)hitbox.Y), hitbox.Width, hitbox.Height, 66, (float)(player.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.3f); + Main.dust[num250].velocity *= 0.2f; + Main.dust[num250].noGravity = true; + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("HolyLight"), 500); + target.AddBuff(mod.BuffType("GlacialState"), 500); + target.AddBuff(mod.BuffType("BrimstoneFlames"), 500); + target.AddBuff(mod.BuffType("Plague"), 500); + } + } +} diff --git a/Items/Weapons/RareVariants/Swordsplosion.png b/Items/Weapons/RareVariants/Swordsplosion.png new file mode 100644 index 0000000000..658f207423 Binary files /dev/null and b/Items/Weapons/RareVariants/Swordsplosion.png differ diff --git a/Items/Weapons/RareVariants/ThornBlossom.cs b/Items/Weapons/RareVariants/ThornBlossom.cs new file mode 100644 index 0000000000..bb968093c4 --- /dev/null +++ b/Items/Weapons/RareVariants/ThornBlossom.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class ThornBlossom : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Thorn Blossom"); + Tooltip.SetDefault("Every rose has its thorn"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 45; + item.magic = true; + item.mana = 10; + item.width = 66; + item.height = 68; + item.useTime = 23; + item.useAnimation = 23; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.UseSound = SoundID.Item109; + item.autoReuse = true; + item.shoot = mod.ProjectileType("BeamingBolt"); + item.shootSpeed = 20f; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + 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) + { + player.statLife -= 5; + if (player.statLife <= 0) + { + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } + for (int index = 0; index < 3; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-120, 121) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-120, 121) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX * 1.5f, SpeedY * 1.5f, 150, (int)((double)damage * 1.5), knockBack, player.whoAmI, 0f, 0f); + } + Projectile.NewProjectile(position.X, position.Y, speedX * 0.66f, speedY * 0.66f, type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RareVariants/ThornBlossom.png b/Items/Weapons/RareVariants/ThornBlossom.png new file mode 100644 index 0000000000..623162fb65 Binary files /dev/null and b/Items/Weapons/RareVariants/ThornBlossom.png differ diff --git a/Items/Weapons/RareVariants/Thunderstorm.cs b/Items/Weapons/RareVariants/Thunderstorm.cs new file mode 100644 index 0000000000..7e508ecd0b --- /dev/null +++ b/Items/Weapons/RareVariants/Thunderstorm.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class Thunderstorm : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Thunderstorm"); + Tooltip.SetDefault("Make it rain"); + } + + public override void SetDefaults() + { + item.damage = 360; + item.mana = 50; + item.magic = true; + item.width = 48; + item.height = 22; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(1, 20, 0, 0); + item.rare = 10; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBlast"); + item.autoReuse = true; + item.shootSpeed = 6f; + item.shoot = mod.ProjectileType("ThunderstormShot"); + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RareVariants/Thunderstorm.png b/Items/Weapons/RareVariants/Thunderstorm.png new file mode 100644 index 0000000000..712ed89215 Binary files /dev/null and b/Items/Weapons/RareVariants/Thunderstorm.png differ diff --git a/Items/Weapons/RareVariants/TrueConferenceCall.cs b/Items/Weapons/RareVariants/TrueConferenceCall.cs new file mode 100644 index 0000000000..ec7eccf04e --- /dev/null +++ b/Items/Weapons/RareVariants/TrueConferenceCall.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class TrueConferenceCall : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Conference Call"); + Tooltip.SetDefault("@everyone"); + } + + public override void SetDefaults() + { + item.damage = 30; + item.ranged = true; + item.width = 66; + item.height = 26; + item.useTime = 24; + item.useAnimation = 24; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4.5f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item38; + item.autoReuse = true; + item.shootSpeed = 18f; + item.shoot = 10; + item.useAmmo = 97; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + 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) + { + int bulletAmt = 6; + for (int index = 0; index < bulletAmt; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-15, 16) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-15, 16) * 0.05f; + int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].extraUpdates += 1; + } + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + num78 *= num80; + num79 *= num80; + for (int num108 = 0; num108 < bulletAmt; num108++) + { + vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); + vector2.Y -= (float)(100 * num108); + num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (num79 < 0f) + { + num79 *= -1f; + } + if (num79 < 20f) + { + num79 = 20f; + } + num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + num80 = num72 / num80; + num78 *= num80; + num79 *= num80; + float speedX4 = num78 + (float)Main.rand.Next(-15, 16) * 0.01f; + float speedY5 = num79 + (float)Main.rand.Next(-15, 16) * 0.01f; + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].extraUpdates += 1; + } + return false; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RareVariants/TrueConferenceCall.png b/Items/Weapons/RareVariants/TrueConferenceCall.png new file mode 100644 index 0000000000..0a0e3263ae Binary files /dev/null and b/Items/Weapons/RareVariants/TrueConferenceCall.png differ diff --git a/Items/Weapons/RareVariants/VoidVortex.cs b/Items/Weapons/RareVariants/VoidVortex.cs new file mode 100644 index 0000000000..c2d6ae03d1 --- /dev/null +++ b/Items/Weapons/RareVariants/VoidVortex.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.RareVariants +{ + public class VoidVortex : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Void Vortex"); + Tooltip.SetDefault("Fires a circular spread of magnetic orbs around the mouse cursor"); + Item.staff[item.type] = true; + } + + public override void SetDefaults() + { + item.damage = 300; + item.magic = true; + item.mana = 60; + item.width = 130; + item.height = 130; + item.useTime = 45; + item.useAnimation = 45; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 0f; + item.value = Item.buyPrice(1, 80, 0, 0); + item.rare = 10; + item.UseSound = SoundID.Item20; + item.autoReuse = true; + item.shoot = mod.ProjectileType("Climax2"); + item.shootSpeed = 12f; + item.GetGlobalItem(mod).postMoonLordRarity = 22; + } + + 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) + { + float num72 = item.shootSpeed; + Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); + float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; + float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; + if (player.gravDir == -1f) + { + num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; + } + float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); + float num81 = num80; + if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) + { + num78 = (float)player.direction; + num79 = 0f; + num80 = num72; + } + else + { + num80 = num72 / num80; + } + vector2 += new Vector2(num78, num79); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(speedX, speedY) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + float passedVar = 1f; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, passedVar, 0f); + Projectile.NewProjectile(vector2.X, vector2.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), type, damage, knockBack, player.whoAmI, -passedVar, 0f); + passedVar += 1f; + } + return false; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/RareVariants/VoidVortex.png b/Items/Weapons/RareVariants/VoidVortex.png new file mode 100644 index 0000000000..05d75f2033 Binary files /dev/null and b/Items/Weapons/RareVariants/VoidVortex.png differ diff --git a/Items/Weapons/Ravager/DrillCannon.png b/Items/Weapons/Ravager/DrillCannon.png deleted file mode 100644 index a2832da98d..0000000000 Binary files a/Items/Weapons/Ravager/DrillCannon.png and /dev/null differ diff --git a/Items/Weapons/Ravager/RealmRavager.cs b/Items/Weapons/Ravager/RealmRavager.cs new file mode 100644 index 0000000000..8846c7bd50 --- /dev/null +++ b/Items/Weapons/Ravager/RealmRavager.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.Ravager +{ + public class RealmRavager : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Realm Ravager"); + Tooltip.SetDefault("Shoots a burst of explosive bullets"); + } + + public override void SetDefaults() + { + item.damage = 50; + item.ranged = true; + item.width = 76; + item.height = 32; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.noMelee = true; + item.knockBack = 4f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.UseSound = SoundID.Item38; + item.autoReuse = true; + item.shootSpeed = 30f; + item.shoot = mod.ProjectileType("RealmRavagerBullet"); + item.useAmmo = 97; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + + 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) + { + for (int index = 0; index < 5; ++index) + { + float SpeedX = speedX + (float)Main.rand.Next(-75, 76) * 0.05f; + float SpeedY = speedY + (float)Main.rand.Next(-75, 76) * 0.05f; + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("RealmRavagerBullet"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + } + return false; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Ravager/RealmRavager.png b/Items/Weapons/Ravager/RealmRavager.png new file mode 100644 index 0000000000..09cfef5709 Binary files /dev/null and b/Items/Weapons/Ravager/RealmRavager.png differ diff --git a/Items/Weapons/Ravager/SpikecragStaff.cs b/Items/Weapons/Ravager/SpikecragStaff.cs new file mode 100644 index 0000000000..78e482697c --- /dev/null +++ b/Items/Weapons/Ravager/SpikecragStaff.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.Ravager +{ + public class SpikecragStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spikecrag Staff"); + Tooltip.SetDefault("Summons an spikecrag to protect you"); + } + + public override void SetDefaults() + { + item.damage = 120; + item.mana = 10; + item.summon = true; + item.sentry = true; + item.width = 50; + item.height = 50; + item.useTime = 30; + item.useAnimation = 30; + item.useStyle = 1; + item.noMelee = true; + item.knockBack = 2f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.autoReuse = true; + item.shootSpeed = 20f; + item.UseSound = SoundID.Item78; + item.shoot = mod.ProjectileType("Spikecrag"); + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + player.UpdateMaxTurrets(); + } + return false; + } + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Ravager/SpikecragStaff.png b/Items/Weapons/Ravager/SpikecragStaff.png new file mode 100644 index 0000000000..27ab4489bf Binary files /dev/null and b/Items/Weapons/Ravager/SpikecragStaff.png differ diff --git a/Items/Weapons/Ravager/UltimusCleaver.cs b/Items/Weapons/Ravager/UltimusCleaver.cs new file mode 100644 index 0000000000..3f5565c910 --- /dev/null +++ b/Items/Weapons/Ravager/UltimusCleaver.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items; + +namespace CalamityMod.Items.Weapons.Ravager +{ + public class UltimusCleaver : ModItem + { + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultimus Cleaver"); + Tooltip.SetDefault("Launches damaging sparks when the player walks on the ground with this weapon out"); + } + + public override void SetDefaults() + { + item.damage = 300; + item.melee = true; + item.rare = 8; + item.width = 82; + item.height = 102; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = 5; + item.knockBack = 5f; + item.value = Item.buyPrice(0, 80, 0, 0); + item.autoReuse = true; + item.shoot = mod.ProjectileType("UltimusCleaverDust"); + item.shootSpeed = 10f; + } + + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, -10); + } + + 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) + { + if(Collision.SolidCollision(position, player.width, player.height) && player.velocity.X != 0) + { + for(int i = 0; i < 5; i++) + { + float posX; + float velocityX; + if(player.direction == 1) + { + posX = (float)Main.rand.Next(10, 60); + velocityX = (float)Main.rand.Next(2, 10); + } + else + { + posX = (float)Main.rand.Next(-60, -10); + velocityX = (float)Main.rand.Next(-10, -2); + } + Projectile.NewProjectile((player.Center.X + posX), (player.Center.Y + 20), velocityX, (float)Main.rand.Next(-7, -3), mod.ProjectileType("UltimusCleaverDust"), (int)((float)item.damage * 0.4), 0f, Main.myPlayer); + } + } + return false; + } + } +} \ No newline at end of file diff --git a/Items/Weapons/Ravager/UltimusCleaver.png b/Items/Weapons/Ravager/UltimusCleaver.png new file mode 100644 index 0000000000..21ebeeb1cb Binary files /dev/null and b/Items/Weapons/Ravager/UltimusCleaver.png differ diff --git a/Items/Weapons/RedtideSword.cs b/Items/Weapons/RedtideSword.cs index 619b068521..95b488243a 100644 --- a/Items/Weapons/RedtideSword.cs +++ b/Items/Weapons/RedtideSword.cs @@ -14,12 +14,13 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Redtide Sword"); - } + Tooltip.SetDefault("Throws short-range whirlpools"); + } public override void SetDefaults() { item.width = 42; - item.damage = 23; + item.damage = 20; item.melee = true; item.useAnimation = 19; item.useStyle = 1; @@ -31,9 +32,17 @@ namespace CalamityMod.Items.Weapons item.height = 42; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = 2; - } + item.shoot = mod.ProjectileType("Whirlpool"); + item.shootSpeed = 6f; + } - public override void AddRecipes() + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "VictideBar", 3); diff --git a/Items/Weapons/RoyalKnivesMelee.png b/Items/Weapons/RoyalKnivesMelee.png index f54945e13e..4d31893202 100644 Binary files a/Items/Weapons/RoyalKnivesMelee.png and b/Items/Weapons/RoyalKnivesMelee.png differ diff --git a/Items/Weapons/Shimmerspark.cs b/Items/Weapons/Shimmerspark.cs index a5863530f5..927257ede1 100644 --- a/Items/Weapons/Shimmerspark.cs +++ b/Items/Weapons/Shimmerspark.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { item.CloneDefaults(ItemID.Chik); - item.damage = 32; + item.damage = 36; item.useTime = 25; item.useAnimation = 25; item.useStyle = 5; diff --git a/Items/Weapons/Shredder.cs b/Items/Weapons/Shredder.cs index e30c360664..63c8ee829c 100644 --- a/Items/Weapons/Shredder.cs +++ b/Items/Weapons/Shredder.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons { return 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) { int bulletAmt = 4; @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons float num8 = speedY; float SpeedX = speedX + (float) Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float) Main.rand.Next(-30, 31) * 0.05f; - int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[shot].timeLeft = 180; } return false; @@ -75,7 +75,7 @@ namespace CalamityMod.Items.Weapons float num8 = speedY; float SpeedX = speedX + (float) Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float) Main.rand.Next(-30, 31) * 0.05f; - int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("ChargedBlast"), damage, knockBack, player.whoAmI, 0.0f, 0.0f); + int shot = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, mod.ProjectileType("ChargedBlast"), damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[shot].timeLeft = 180; } return false; diff --git a/Items/Weapons/SlimeGod/CorroslimeStaff.cs b/Items/Weapons/SlimeGod/CorroslimeStaff.cs index f1aaef86c2..ed50d5773a 100644 --- a/Items/Weapons/SlimeGod/CorroslimeStaff.cs +++ b/Items/Weapons/SlimeGod/CorroslimeStaff.cs @@ -54,39 +54,30 @@ namespace CalamityMod.Items.Weapons.SlimeGod recipe.AddRecipe(); } - 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) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = damage; - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("Corroslime"), num73, num74, i, 0f, 0f); - return false; - } - } + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } \ No newline at end of file diff --git a/Items/Weapons/SlimeGod/CrimslimeStaff.cs b/Items/Weapons/SlimeGod/CrimslimeStaff.cs index 9f0d2274ba..0f71855fc0 100644 --- a/Items/Weapons/SlimeGod/CrimslimeStaff.cs +++ b/Items/Weapons/SlimeGod/CrimslimeStaff.cs @@ -54,39 +54,30 @@ namespace CalamityMod.Items.Weapons.SlimeGod recipe.AddRecipe(); } - 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) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = damage; - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("Crimslime"), num73, num74, i, 0f, 0f); - return false; - } - } + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } \ No newline at end of file diff --git a/Items/Weapons/SoulHarvester.cs b/Items/Weapons/SoulHarvester.cs index d57c9089a0..0df0d3b025 100644 --- a/Items/Weapons/SoulHarvester.cs +++ b/Items/Weapons/SoulHarvester.cs @@ -9,83 +9,79 @@ using CalamityMod.Items; namespace CalamityMod.Items.Weapons { - public class SoulHarvester : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Soul Harvester"); - Tooltip.SetDefault("Enemies explode when on low health, spreading the plague"); - } + public class SoulHarvester : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Soul Harvester"); + Tooltip.SetDefault("Enemies explode when on low health, spreading the plague"); + } - public override void SetDefaults() - { - item.width = 62; - item.damage = 98; - item.melee = true; - item.useAnimation = 20; - item.useStyle = 1; - item.useTime = 20; - item.useTurn = true; - item.knockBack = 7.5f; - item.UseSound = SoundID.Item71; - item.autoReuse = true; - item.height = 64; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shoot = mod.ProjectileType("SoulScythe"); - item.shootSpeed = 18f; - } + public override void SetDefaults() + { + item.width = 62; + item.damage = 98; + item.melee = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.useTurn = true; + item.knockBack = 7.5f; + item.UseSound = SoundID.Item71; + item.autoReuse = true; + item.height = 64; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shoot = mod.ProjectileType("SoulScythe"); + item.shootSpeed = 18f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "PlagueCellCluster", 10); - recipe.AddIngredient(ItemID.CursedFlame, 20); - recipe.AddIngredient(ItemID.DeathSickle); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(null, "PlagueCellCluster", 10); + recipe.AddIngredient(ItemID.CursedFlame, 20); + recipe.AddIngredient(ItemID.DeathSickle); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(3) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 75); - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(3) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 75); + } + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("Plague"), 200); - target.AddBuff(BuffID.CursedInferno, 200); - if (target.life <= (target.lifeMax * 0.15f)) - { - Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 14); - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("HiveBombExplosion"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - player.position.X = player.position.X + (float)(player.width / 2); - player.position.Y = player.position.Y + (float)(player.height / 2); - player.position.X = player.position.X - (float)(player.width / 2); - player.position.Y = player.position.Y - (float)(player.height / 2); - for (int num621 = 0; num621 < 30; num621++) - { - int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default(Color), 2f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.Next(2) == 0) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity *= 2f; - } - } - } - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 200); + target.AddBuff(BuffID.CursedInferno, 200); + if (target.life <= (target.lifeMax * 0.15f)) + { + Main.PlaySound(2, (int)player.position.X, (int)player.position.Y, 14); + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("HiveBombExplosion"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + for (int num621 = 0; num621 < 30; num621++) + { + int num622 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(player.position.X, player.position.Y), player.width, player.height, 89, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } + } } diff --git a/Items/Weapons/SpectralstormCannon.cs b/Items/Weapons/SpectralstormCannon.cs index 814e9ab722..b071d96b07 100644 --- a/Items/Weapons/SpectralstormCannon.cs +++ b/Items/Weapons/SpectralstormCannon.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -56,8 +57,9 @@ namespace CalamityMod.Items.Weapons int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); Main.projectile[projectile].timeLeft = 200; } - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 1f, 0.0f); - return false; + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceRanged = true; + return false; } public override void AddRecipes() diff --git a/Items/Weapons/SpectreRifle.cs b/Items/Weapons/SpectreRifle.cs index 65ad15bc60..7be7e997aa 100644 --- a/Items/Weapons/SpectreRifle.cs +++ b/Items/Weapons/SpectreRifle.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -44,8 +45,9 @@ namespace CalamityMod.Items.Weapons 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 1f, 0.0f); - return false; + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceRanged = true; + return false; } public override void AddRecipes() diff --git a/Items/Weapons/SporeKnife.cs b/Items/Weapons/SporeKnife.cs index 7831d0d500..fa8532972b 100644 --- a/Items/Weapons/SporeKnife.cs +++ b/Items/Weapons/SporeKnife.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -56,8 +57,9 @@ namespace CalamityMod.Items.Weapons { if (target.life <= 0) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, Main.rand.Next(569, 572), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); - } + int proj = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, Main.rand.Next(569, 572), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } } } } diff --git a/Items/Weapons/StarCannonEX.cs b/Items/Weapons/StarCannonEX.cs index 0ebd86c431..3581ccbd9c 100644 --- a/Items/Weapons/StarCannonEX.cs +++ b/Items/Weapons/StarCannonEX.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -56,12 +57,9 @@ namespace CalamityMod.Items.Weapons case 1: type = 9; break; case 2: type = mod.ProjectileType("AstralStar"); break; } - int star = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); - Main.projectile[star].ranged = true; - Main.projectile[star].magic = false; - Main.projectile[star].melee = false; - Main.projectile[star].netUpdate = true; - } + int star = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[star].GetGlobalProjectile(mod).forceRanged = true; + } return false; } diff --git a/Items/Weapons/StarfleetMK2.cs b/Items/Weapons/StarfleetMK2.cs index 2956b7ebb0..c34ead9f77 100644 --- a/Items/Weapons/StarfleetMK2.cs +++ b/Items/Weapons/StarfleetMK2.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -25,8 +26,8 @@ namespace CalamityMod.Items.Weapons item.useAnimation = 27; item.useTime = 27; item.reuseDelay = 0; - item.width = 98; - item.height = 32; + item.width = 122; + item.height = 50; item.UseSound = SoundID.Item92; item.shoot = mod.ProjectileType("StarfleetMK2"); item.value = Item.buyPrice(1, 80, 0, 0); @@ -48,10 +49,10 @@ namespace CalamityMod.Items.Weapons 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) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("StarfleetMK2"), 0, 0f, player.whoAmI); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("StarfleetMK2"), 0, 0f, player.whoAmI); return false; } - + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/StarfleetMK2.png b/Items/Weapons/StarfleetMK2.png index f6a9035595..3cef0ffadf 100644 Binary files a/Items/Weapons/StarfleetMK2.png and b/Items/Weapons/StarfleetMK2.png differ diff --git a/Items/Weapons/StarnightLance.cs b/Items/Weapons/StarnightLance.cs index 2f67b1990f..5081cc5a3f 100644 --- a/Items/Weapons/StarnightLance.cs +++ b/Items/Weapons/StarnightLance.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { item.width = 72; - item.damage = 60; + item.damage = 68; item.melee = true; item.noMelee = true; item.useTurn = true; diff --git a/Items/Weapons/StellarStriker.cs b/Items/Weapons/StellarStriker.cs index ee0f4d1c43..503f6fda21 100644 --- a/Items/Weapons/StellarStriker.cs +++ b/Items/Weapons/StellarStriker.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -88,7 +89,8 @@ namespace CalamityMod.Items.Weapons num79 *= num80; float num114 = num78; float num115 = num79 + (float)Main.rand.Next(-80, 81) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, 645, (int)((double)((float)item.damage * player.meleeDamage) * 0.5), knockback, i, 0f, (float)Main.rand.Next(3)); + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, num114, num115, 645, (int)((double)((float)item.damage * player.meleeDamage) * 0.5), knockback, i, 0f, (float)Main.rand.Next(3)); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; } } diff --git a/Items/Weapons/SunkenSea/ShellfishStaff.cs b/Items/Weapons/SunkenSea/ShellfishStaff.cs index a9603b5a89..4010f8b7dc 100644 --- a/Items/Weapons/SunkenSea/ShellfishStaff.cs +++ b/Items/Weapons/SunkenSea/ShellfishStaff.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.SunkenSea public override void SetDefaults() { - item.damage = 100; + item.damage = 70; item.mana = 10; item.width = 50; item.height = 50; @@ -44,39 +44,30 @@ namespace CalamityMod.Items.Weapons.SunkenSea item.summon = 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) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = damage; - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("Shellfish"), num73, num74, i, 0f, 0f); - return false; - } - } + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } \ No newline at end of file diff --git a/Items/Weapons/TerraEdge.cs b/Items/Weapons/TerraEdge.cs index 4aad3406dc..9a483e6778 100644 --- a/Items/Weapons/TerraEdge.cs +++ b/Items/Weapons/TerraEdge.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { item.width = 58; - item.damage = 152; + item.damage = 112; item.melee = true; item.useAnimation = 17; item.useStyle = 1; diff --git a/Items/Weapons/TerraLance.cs b/Items/Weapons/TerraLance.cs index 1a78fb03c2..e5f0c85f50 100644 --- a/Items/Weapons/TerraLance.cs +++ b/Items/Weapons/TerraLance.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { item.width = 44; - item.damage = 100; + item.damage = 88; item.melee = true; item.noMelee = true; item.useTurn = true; diff --git a/Items/Weapons/TerraRay.cs b/Items/Weapons/TerraRay.cs index 2069ba6488..2d5176193f 100644 --- a/Items/Weapons/TerraRay.cs +++ b/Items/Weapons/TerraRay.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { - item.damage = 70; + item.damage = 75; item.magic = true; item.mana = 10; item.width = 54; diff --git a/Items/Weapons/TerraShiv.cs b/Items/Weapons/TerraShiv.cs index 4fb929ac0b..6fe4a32692 100644 --- a/Items/Weapons/TerraShiv.cs +++ b/Items/Weapons/TerraShiv.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons item.useTime = 13; item.width = 42; item.height = 42; - item.damage = 140; + item.damage = 125; item.melee = true; item.knockBack = 6.5f; item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Terracotta.cs b/Items/Weapons/Terracotta.cs index 0a633c81d4..9e5427a72d 100644 --- a/Items/Weapons/Terracotta.cs +++ b/Items/Weapons/Terracotta.cs @@ -8,77 +8,67 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons { - public class Terracotta : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Terra-cotta"); - Tooltip.SetDefault("Causes enemies to erupt into healing projectiles on death\nEnemies explode on death"); - } + public class Terracotta : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Terra-cotta"); + Tooltip.SetDefault("Causes enemies to erupt into healing projectiles on death\n" + + "Enemies explode on hit"); + } - public override void SetDefaults() - { - item.width = 48; - item.damage = 125; - item.melee = true; - item.useAnimation = 17; - item.useTime = 17; - item.useTurn = true; - item.useStyle = 1; - item.knockBack = 5.5f; - item.UseSound = SoundID.Item1; - item.autoReuse = true; - item.height = 60; - item.value = Item.buyPrice(0, 80, 0, 0); - item.rare = 8; - item.shootSpeed = 5f; - } + public override void SetDefaults() + { + item.width = 48; + item.damage = 125; + item.melee = true; + item.useAnimation = 17; + item.useTime = 17; + item.useTurn = true; + item.useStyle = 1; + item.knockBack = 5.5f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 60; + item.value = Item.buyPrice(0, 80, 0, 0); + item.rare = 8; + item.shootSpeed = 5f; + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(null, "BurntSienna"); - recipe.AddIngredient(null, "UnholyCore", 3); - recipe.AddIngredient(null, "CoreofCinder", 3); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + float spread = 180f * 0.0174f; + double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (target.life <= 0) + { + for (i = 0; i < 1; i++) + { + float randomSpeedX = (float)Main.rand.Next(3); + float randomSpeedY = (float)Main.rand.Next(3, 5); + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + int projectile1 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Terracotta"), 0, 0f, Main.myPlayer); + int projectile2 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Terracotta"), 0, 0f, Main.myPlayer); + int projectile3 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Terracotta"), 0, 0f, Main.myPlayer); + Main.projectile[projectile1].velocity.X = -randomSpeedX; + Main.projectile[projectile1].velocity.Y = -randomSpeedY; + Main.projectile[projectile2].velocity.X = randomSpeedX; + Main.projectile[projectile2].velocity.Y = -randomSpeedY; + Main.projectile[projectile3].velocity.X = 0f; + Main.projectile[projectile3].velocity.Y = -randomSpeedY; + } + } + Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("TerracottaExplosion"), (int)((float)item.damage * player.meleeDamage), knockback, Main.myPlayer); + } - public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) - { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(item.shootSpeed, item.shootSpeed) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (target.life <= 0) - { - for (i = 0; i < 1; i++) - { - float randomSpeedX = (float)Main.rand.Next(3); - float randomSpeedY = (float)Main.rand.Next(3, 5); - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - int projectile1 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Terracotta"), item.damage, knockback, Main.myPlayer); - int projectile2 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Terracotta"), item.damage, knockback, Main.myPlayer); - int projectile3 = Projectile.NewProjectile(target.Center.X, target.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("Terracotta"), item.damage, knockback, Main.myPlayer); - Main.projectile[projectile1].velocity.X = -randomSpeedX; - Main.projectile[projectile1].velocity.Y = -randomSpeedY; - Main.projectile[projectile2].velocity.X = randomSpeedX; - Main.projectile[projectile2].velocity.Y = -randomSpeedY; - Main.projectile[projectile3].velocity.X = 0f; - Main.projectile[projectile3].velocity.Y = -randomSpeedY; - } - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("TerracottaExplosion"), item.damage, knockback, Main.myPlayer); - } - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.Next(5) == 0) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246); - } - } - } + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.Next(5) == 0) + { + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246); + } + } + } } diff --git a/Items/Weapons/TheSwarmer.cs b/Items/Weapons/TheSwarmer.cs index c53987edc8..b91437b5e1 100644 --- a/Items/Weapons/TheSwarmer.cs +++ b/Items/Weapons/TheSwarmer.cs @@ -6,6 +6,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Items; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -59,14 +60,16 @@ namespace CalamityMod.Items.Weapons float SpeedY = speedY + (float)Main.rand.Next(-35, 36) * 0.05f; int wasps = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, 0f, player.whoAmI, 0.0f, 0.0f); Main.projectile[wasps].penetrate = 1; - } + Main.projectile[wasps].GetGlobalProjectile(mod).forceMagic = true; + } for (int i = 0; i <= 3; i++) { float SpeedX2 = speedX + (float)Main.rand.Next(-35, 36) * 0.05f; float SpeedY2 = speedY + (float)Main.rand.Next(-35, 36) * 0.05f; int bees = Projectile.NewProjectile(position.X, position.Y, SpeedX2, SpeedY2, player.beeType(), player.beeDamage(item.damage), player.beeKB(0f), player.whoAmI, 0.0f, 0.0f); Main.projectile[bees].penetrate = 1; - } + Main.projectile[bees].GetGlobalProjectile(mod).forceMagic = true; + } return false; } } diff --git a/Items/Weapons/Trinity.cs b/Items/Weapons/Trinity.cs index 77cc408fee..8253cbc0a9 100644 --- a/Items/Weapons/Trinity.cs +++ b/Items/Weapons/Trinity.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -47,8 +48,9 @@ namespace CalamityMod.Items.Weapons { float SpeedX = speedX + (float)Main.rand.Next(-30, 31) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-30, 31) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.6f), knockBack, Main.myPlayer, 1f, 0f); - } + int proj = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.6), knockBack, Main.myPlayer, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } return false; } diff --git a/Items/Weapons/TrueArkoftheAncients.cs b/Items/Weapons/TrueArkoftheAncients.cs index 5a0455b63f..c4ea55dc9a 100644 --- a/Items/Weapons/TrueArkoftheAncients.cs +++ b/Items/Weapons/TrueArkoftheAncients.cs @@ -5,6 +5,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { item.width = 60; - item.damage = 85; + item.damage = 60; item.melee = true; item.useAnimation = 25; item.useTime = 25; @@ -71,7 +72,7 @@ namespace CalamityMod.Items.Weapons } num78 *= num80; num79 *= num80; - int num107 = 3; + int num107 = 2; for (int num108 = 0; num108 < num107; num108++) { vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); @@ -93,8 +94,9 @@ namespace CalamityMod.Items.Weapons num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-160, 161) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-160, 161) * 0.02f; - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, damage, num74, i, 1f, (float)Main.rand.Next(10)); - Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("TerraBall"), damage, num74, i, 0f, (float)Main.rand.Next(5)); + int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, 92, damage, num74, i, 0f, (float)Main.rand.Next(10)); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, mod.ProjectileType("TerraBall"), damage, num74, i, 0f, (float)Main.rand.Next(5)); } return false; } diff --git a/Items/Weapons/TrueBiomeBlade.cs b/Items/Weapons/TrueBiomeBlade.cs index 6961b1226c..0bc8a9406b 100644 --- a/Items/Weapons/TrueBiomeBlade.cs +++ b/Items/Weapons/TrueBiomeBlade.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { item.width = 54; - item.damage = 94; + item.damage = 160; item.melee = true; item.useAnimation = 21; item.useTime = 21; diff --git a/Items/Weapons/TrueCausticEdge.cs b/Items/Weapons/TrueCausticEdge.cs index 13ecba33d1..2bd5efb1dc 100644 --- a/Items/Weapons/TrueCausticEdge.cs +++ b/Items/Weapons/TrueCausticEdge.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { - item.width = 62; + item.width = 64; item.damage = 42; item.melee = true; item.useAnimation = 28; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons item.knockBack = 5.75f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 68; + item.height = 74; item.value = Item.buyPrice(0, 36, 0, 0); item.rare = 5; item.shoot = mod.ProjectileType("TrueCausticEdgeProjectile"); @@ -65,8 +65,9 @@ namespace CalamityMod.Items.Weapons public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 300); - target.AddBuff(BuffID.Venom, 180); + target.AddBuff(BuffID.Poisoned, 600); + target.AddBuff(BuffID.OnFire, 300); + target.AddBuff(BuffID.Venom, 300); } } } diff --git a/Items/Weapons/TrueCausticEdge.png b/Items/Weapons/TrueCausticEdge.png index e0f9719138..1c0fb1c10f 100644 Binary files a/Items/Weapons/TrueCausticEdge.png and b/Items/Weapons/TrueCausticEdge.png differ diff --git a/Items/Weapons/TrueTyrantYharimsUltisword.cs b/Items/Weapons/TrueTyrantYharimsUltisword.cs index dfa78ed78e..f97a579803 100644 --- a/Items/Weapons/TrueTyrantYharimsUltisword.cs +++ b/Items/Weapons/TrueTyrantYharimsUltisword.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { - item.width = 86; + item.width = 102; item.damage = 185; item.melee = true; item.useAnimation = 18; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.knockBack = 7.5f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 86; + item.height = 102; item.value = Item.buyPrice(1, 20, 0, 0); item.rare = 10; item.shoot = mod.ProjectileType("BlazingPhantomBlade"); diff --git a/Items/Weapons/TrueTyrantYharimsUltisword.png b/Items/Weapons/TrueTyrantYharimsUltisword.png index 76e2714988..2de0d2d06e 100644 Binary files a/Items/Weapons/TrueTyrantYharimsUltisword.png and b/Items/Weapons/TrueTyrantYharimsUltisword.png differ diff --git a/Items/Weapons/TyrantYharimsUltisword.cs b/Items/Weapons/TyrantYharimsUltisword.cs index bd9ccd8ef7..9e8175c17c 100644 --- a/Items/Weapons/TyrantYharimsUltisword.cs +++ b/Items/Weapons/TyrantYharimsUltisword.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons public override void SetDefaults() { - item.width = 84; + item.width = 88; item.damage = 64; item.melee = true; item.useAnimation = 26; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons item.knockBack = 5.5f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 84; + item.height = 88; item.value = Item.buyPrice(0, 80, 0, 0); item.rare = 8; item.shoot = mod.ProjectileType("BlazingPhantomBlade"); diff --git a/Items/Weapons/TyrantYharimsUltisword.png b/Items/Weapons/TyrantYharimsUltisword.png index fbeea535c9..10b1593e0f 100644 Binary files a/Items/Weapons/TyrantYharimsUltisword.png and b/Items/Weapons/TyrantYharimsUltisword.png differ diff --git a/Items/Weapons/Vehemenc.cs b/Items/Weapons/Vehemenc.cs index 5aed51a176..90744b29eb 100644 --- a/Items/Weapons/Vehemenc.cs +++ b/Items/Weapons/Vehemenc.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons DisplayName.SetDefault("Vehemence"); Tooltip.SetDefault("Casts an intense energy blast\n" + "Does far more damage the more HP an enemy has left\n" + - "Max damage is capped at 500,000\n" + + "Max damage is capped at 1,000,000\n" + "If an enemy has full HP it will inflict several long-lasting debuffs\n" + "Revengeance drop"); Item.staff[item.type] = true; diff --git a/Items/Weapons/Waraxe.cs b/Items/Weapons/Waraxe.cs index a2934ce328..c78525d7fb 100644 --- a/Items/Weapons/Waraxe.cs +++ b/Items/Weapons/Waraxe.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Waraxe"); - } + Tooltip.SetDefault("Critical hits cleave enemy armor, reducing their defense by 15 and protection by 25%"); + } public override void SetDefaults() { @@ -28,10 +29,17 @@ namespace CalamityMod.Items.Weapons item.axe = 10; item.useStyle = 1; item.knockBack = 5.25f; - item.value = 50000; item.value = Item.buyPrice(0, 1, 0, 0); item.UseSound = SoundID.Item1; item.autoReuse = true; } - } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (crit) + { + target.AddBuff(mod.BuffType("WarCleave"), 900); + } + } + } } \ No newline at end of file diff --git a/Items/Weapons/Warblade.cs b/Items/Weapons/Warblade.cs index 8b0ae28475..9fb6695294 100644 --- a/Items/Weapons/Warblade.cs +++ b/Items/Weapons/Warblade.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Warblade"); - } + Tooltip.SetDefault("Critical hits cleave enemy armor, reducing their defense by 15 and protection by 25%"); + } public override void SetDefaults() { @@ -32,5 +33,13 @@ namespace CalamityMod.Items.Weapons item.UseSound = SoundID.Item1; item.autoReuse = true; } - } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + if (crit) + { + target.AddBuff(mod.BuffType("WarCleave"), 450); + } + } + } } \ No newline at end of file diff --git a/Items/Weapons/WindBlade.cs b/Items/Weapons/WindBlade.cs index 431d149152..1bc42a28d3 100644 --- a/Items/Weapons/WindBlade.cs +++ b/Items/Weapons/WindBlade.cs @@ -14,12 +14,13 @@ namespace CalamityMod.Items.Weapons public override void SetStaticDefaults() { DisplayName.SetDefault("Wind Blade"); - } + Tooltip.SetDefault("Fires cyclones that suck enemies in"); + } public override void SetDefaults() { item.width = 58; - item.damage = 29; + item.damage = 27; item.melee = true; item.useAnimation = 20; item.useStyle = 1; @@ -31,9 +32,17 @@ namespace CalamityMod.Items.Weapons item.height = 58; item.value = Item.buyPrice(0, 4, 0, 0); item.rare = 3; - } + item.shoot = mod.ProjectileType("Cyclone"); + item.shootSpeed = 3f; + } - public override void AddRecipes() + 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) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage / 2, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "AerialiteBar", 9); diff --git a/Items/Weapons/Yharon/AngryChickenStaff.cs b/Items/Weapons/Yharon/AngryChickenStaff.cs index a748908c6f..f21acc7e84 100644 --- a/Items/Weapons/Yharon/AngryChickenStaff.cs +++ b/Items/Weapons/Yharon/AngryChickenStaff.cs @@ -46,39 +46,30 @@ namespace CalamityMod.Items.Weapons.Yharon item.GetGlobalItem(mod).postMoonLordRarity = 14; } - 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) - { - int i = Main.myPlayer; - float num72 = item.shootSpeed; - int num73 = damage; - float num74 = knockBack; - num74 = player.GetWeaponKnockback(item, num74); - player.itemTime = item.useTime; - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - float num78 = (float)Main.mouseX + Main.screenPosition.X - vector2.X; - float num79 = (float)Main.mouseY + Main.screenPosition.Y - vector2.Y; - if (player.gravDir == -1f) - { - num79 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector2.Y; - } - float num80 = (float)Math.Sqrt((double)(num78 * num78 + num79 * num79)); - float num81 = num80; - if ((float.IsNaN(num78) && float.IsNaN(num79)) || (num78 == 0f && num79 == 0f)) - { - num78 = (float)player.direction; - num79 = 0f; - num80 = num72; - } - else - { - num80 = num72 / num80; - } - num78 = 0f; - num79 = 0f; - vector2.X = (float)Main.mouseX + Main.screenPosition.X; - vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(vector2.X, vector2.Y, num78, num79, mod.ProjectileType("AngryChicken"), num73, num74, i, 0f, 0f); - return false; - } - } + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse != 2) + { + position = Main.MouseWorld; + speedX = 0; + speedY = 0; + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI); + } + return false; + } + + public override bool UseItem(Player player) + { + if (player.altFunctionUse == 2) + { + player.MinionNPCTargetAim(); + } + return base.UseItem(player); + } + } } \ No newline at end of file diff --git a/Items/Yharon/ChickenEgg.cs b/Items/Yharon/ChickenEgg.cs index b81a16ec8c..de1eb32141 100644 --- a/Items/Yharon/ChickenEgg.cs +++ b/Items/Yharon/ChickenEgg.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Yharon public override bool CanUseItem(Player player) { - return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("Yharon")); + return player.ZoneJungle && !NPC.AnyNPCs(mod.NPCType("Yharon")) && CalamityWorld.downedBossAny; } public override bool UseItem(Player player) diff --git a/Items/Yharon/YharonBag.cs b/Items/Yharon/YharonBag.cs index 8d4fd8043d..6e8a85fdf0 100644 --- a/Items/Yharon/YharonBag.cs +++ b/Items/Yharon/YharonBag.cs @@ -51,6 +51,10 @@ namespace CalamityMod.Items.Yharon } } player.TryGettingDevArmor(); + if (Main.rand.Next(10) == 0) + { + player.QuickSpawnItem(mod.ItemType("ForgottenDragonEgg")); + } if (Main.rand.Next(3) == 0) { player.QuickSpawnItem(mod.ItemType("AngryChickenStaff")); diff --git a/NPCs/AbyssNPCs/AquaticScourgeBody.cs b/NPCs/AbyssNPCs/AquaticScourgeBody.cs index 665520f6e0..601c71951d 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeBody.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeBody.cs @@ -40,6 +40,8 @@ namespace CalamityMod.NPCs.AbyssNPCs { npc.lifeMax = CalamityWorld.death ? 4300000 : 4000000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; diff --git a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs index 7f808ce4fc..1fd48e10c9 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs @@ -40,6 +40,8 @@ namespace CalamityMod.NPCs.AbyssNPCs { npc.lifeMax = CalamityWorld.death ? 4300000 : 4000000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; diff --git a/NPCs/AbyssNPCs/AquaticScourgeHead.cs b/NPCs/AbyssNPCs/AquaticScourgeHead.cs index ed4c76be61..644b508615 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeHead.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeHead.cs @@ -48,6 +48,8 @@ namespace CalamityMod.NPCs.AbyssNPCs { npc.lifeMax = CalamityWorld.death ? 4300000 : 4000000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; @@ -129,7 +131,7 @@ namespace CalamityMod.NPCs.AbyssNPCs if (detectsPlayer) { npc.localAI[0] += 1f; - if (npc.localAI[0] >= (npc.GetGlobalNPC(mod).enraged ? 120f : 180f)) + if (npc.localAI[0] >= ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 120f : 180f)) { int npcPoxX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; int npcPoxY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; @@ -157,7 +159,11 @@ namespace CalamityMod.NPCs.AbyssNPCs } } npc.localAI[1] += 1f; - if (npc.localAI[1] >= (npc.GetGlobalNPC(mod).enraged ? 300f : 450f)) + if (Main.player[npc.target].gravDir == -1f) + { + npc.localAI[1] += 2f; + } + if (npc.localAI[1] >= ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 300f : 450f)) { int npcPoxX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; int npcPoxY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; @@ -286,17 +292,22 @@ namespace CalamityMod.NPCs.AbyssNPCs } if (detectsPlayer) { - num188 = 7f; - num189 = 0.11f; + num188 = 8f; + num189 = 0.12f; if (!Main.player[npc.target].wet) { - num188 = 11f; - num189 = 0.14f; + num188 = 13f; + num189 = 0.16f; } if (notOcean) { num188 = 15f; - num189 = 0.17f; + num189 = 0.18f; + } + if (Main.player[npc.target].gravDir == -1f) + { + num188 = 20f; + num189 = 0.2f; } } float num48 = num188 * 1.3f; diff --git a/NPCs/AbyssNPCs/AquaticScourgeTail.cs b/NPCs/AbyssNPCs/AquaticScourgeTail.cs index 30dfbd4574..6c8f93bd2e 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeTail.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeTail.cs @@ -40,6 +40,8 @@ namespace CalamityMod.NPCs.AbyssNPCs { npc.lifeMax = CalamityWorld.death ? 4300000 : 4000000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; diff --git a/NPCs/AbyssNPCs/ColossalSquid.cs b/NPCs/AbyssNPCs/ColossalSquid.cs index 9c6e37d61b..2c0fdf447b 100644 --- a/NPCs/AbyssNPCs/ColossalSquid.cs +++ b/NPCs/AbyssNPCs/ColossalSquid.cs @@ -35,9 +35,9 @@ namespace CalamityMod.NPCs.AbyssNPCs for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; npc.timeLeft = NPC.activeTime * 30; npc.value = Item.buyPrice(0, 25, 0, 0); npc.HitSound = SoundID.NPCHit20; diff --git a/NPCs/AbyssNPCs/DevilFish.cs b/NPCs/AbyssNPCs/DevilFish.cs index 53dcfd69fe..ff1bf87200 100644 --- a/NPCs/AbyssNPCs/DevilFish.cs +++ b/NPCs/AbyssNPCs/DevilFish.cs @@ -312,6 +312,10 @@ namespace CalamityMod.NPCs.AbyssNPCs if (NPC.downedGolemBoss) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ChaoticOre"), Main.rand.Next(3, 10)); + if (Main.rand.Next(200) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Hellborn")); + } } } diff --git a/NPCs/AbyssNPCs/EidolonWyrmHead.cs b/NPCs/AbyssNPCs/EidolonWyrmHead.cs index 6ec84afc1f..4aecac24db 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHead.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHead.cs @@ -515,8 +515,7 @@ namespace CalamityMod.NPCs.AbyssNPCs { return SpawnCondition.CaveJellyfish.Chance * 0.3f; } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && - !NPC.AnyNPCs(mod.NPCType("Reaper")) && !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge"))) + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead"))) { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } diff --git a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs index 134dfccd98..3597d4cc0b 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs @@ -477,6 +477,12 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion) diff --git a/NPCs/AbyssNPCs/GulperEelHead.cs b/NPCs/AbyssNPCs/GulperEelHead.cs index 8ee7799cf4..f911f04325 100644 --- a/NPCs/AbyssNPCs/GulperEelHead.cs +++ b/NPCs/AbyssNPCs/GulperEelHead.cs @@ -173,19 +173,19 @@ namespace CalamityMod.NPCs.AbyssNPCs if (num42 > 0) { num42 *= 16; - float num47 = (float)(num42 - 200); //800 + float num47 = (float)(num42 - 400); //800 if (!detectsPlayer) { num192 = num47; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 300f) { if (npc.velocity.X > 0f) { - num191 = Main.player[npc.target].Center.X + 300f; + num191 = Main.player[npc.target].Center.X + 400f; } else { - num191 = Main.player[npc.target].Center.X - 300f; + num191 = Main.player[npc.target].Center.X - 400f; } } } diff --git a/NPCs/AbyssNPCs/Reaper.cs b/NPCs/AbyssNPCs/Reaper.cs index e03ca73cd8..91b3ba3170 100644 --- a/NPCs/AbyssNPCs/Reaper.cs +++ b/NPCs/AbyssNPCs/Reaper.cs @@ -36,9 +36,9 @@ namespace CalamityMod.NPCs.AbyssNPCs for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; npc.timeLeft = NPC.activeTime * 30; npc.value = Item.buyPrice(0, 25, 0, 0); npc.HitSound = SoundID.NPCHit56; @@ -625,8 +625,7 @@ namespace CalamityMod.NPCs.AbyssNPCs { return SpawnCondition.CaveJellyfish.Chance * 0.6f; } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper")) && - !NPC.AnyNPCs(mod.NPCType("ColossalSquid")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHead")) && !NPC.AnyNPCs(mod.NPCType("EidolonWyrmHeadHuge"))) + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water && !NPC.AnyNPCs(mod.NPCType("Reaper"))) { return SpawnCondition.CaveJellyfish.Chance * 1.2f; } @@ -646,7 +645,14 @@ namespace CalamityMod.NPCs.AbyssNPCs Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ReaperTooth"), Main.rand.Next(3, 5)); if (Main.rand.Next(3) == 0) { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Valediction")); + if (Main.rand.Next(33) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheReaper")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Valediction")); + } } } if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) diff --git a/NPCs/Astrageldon/Astrageldon.cs b/NPCs/Astrageldon/Astrageldon.cs index 5a0616523f..4c34736a44 100644 --- a/NPCs/Astrageldon/Astrageldon.cs +++ b/NPCs/Astrageldon/Astrageldon.cs @@ -10,778 +10,774 @@ using CalamityMod.Projectiles; namespace CalamityMod.NPCs.Astrageldon { - [AutoloadBossHead] - public class Astrageldon : ModNPC + [AutoloadBossHead] + public class Astrageldon : ModNPC { - private float bossLife; - + private float bossLife; + public override void SetStaticDefaults() { DisplayName.SetDefault("Astrum Aureus"); Main.npcFrameCount[npc.type] = 6; } - + public override void SetDefaults() { - npc.npcSlots = 15f; - npc.damage = 90; + npc.npcSlots = 15f; + npc.damage = 90; npc.width = 400; npc.height = 280; npc.defense = 120; - npc.lifeMax = CalamityWorld.revenge ? 81300 : 63750; - if (CalamityWorld.death) - { - npc.lifeMax = 126100; - } + npc.lifeMax = CalamityWorld.revenge ? 102000 : 80000; + if (CalamityWorld.death) + { + npc.lifeMax = 158000; + } npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 15, 0, 0); for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - } + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.boss = true; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astrageldon"); - else - music = MusicID.Boss3; - bossBag = mod.ItemType("AstrageldonBag"); - if (NPC.downedMoonlord && CalamityWorld.revenge) - { - npc.lifeMax = 400000; - npc.value = Item.buyPrice(0, 35, 0, 0); - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1400000 : 1200000; - } - } - + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astrageldon"); + else + music = MusicID.Boss3; + bossBag = mod.ItemType("AstrageldonBag"); + if (NPC.downedMoonlord && CalamityWorld.revenge) + { + npc.lifeMax = 400000; + npc.value = Item.buyPrice(0, 35, 0, 0); + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1400000 : 1200000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } + public override void AI() { bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); int shootBuff = (int)(2f * (1f - (float)npc.life / (float)npc.lifeMax)); float shootTimer = 1f + ((float)shootBuff); - bool dayTime = Main.dayTime; - Player player = Main.player[npc.target]; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (!player.active || player.dead || dayTime) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - npc.noTileCollide = true; - npc.velocity = new Vector2(0f, 10f); - if (npc.timeLeft > 150) - { - npc.timeLeft = 150; - } - return; - } - } - else - { - if (npc.timeLeft < 1800) - { - npc.timeLeft = 1800; - } - } - if (npc.ai[0] != 1f) //emit light when not recharging - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 2.55f, 1f, 0f); - } - if (npc.ai[0] == 2f || npc.ai[0] >= 5f || (npc.ai[0] == 4f && npc.velocity.Y > 0f) || npc.GetGlobalNPC(mod).enraged) //fire fast, latent homing, projectiles while walking. lasers in a circle pattern while teleporting - { - if (Main.netMode != 1) - { - npc.localAI[0] += ((npc.ai[0] == 2f || (npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode)) ? 4f : shootTimer); - if (npc.localAI[0] >= 180f) //6 seconds 3 seconds 2 seconds - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - int laserDamage = expertMode ? 35 : 45; //180 120 - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 33); - if (NPC.downedMoonlord && revenge && !CalamityWorld.bossRushActive) - { - laserDamage *= 3; - } - if ((npc.ai[0] >= 5f && npc.ai[0] != 7) || npc.GetGlobalNPC(mod).enraged) //teleporting - { - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 7f), - (float)(Math.Cos(offsetAngle) * 7f), mod.ProjectileType("AstralFlame"), laserDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 7f), - (float)(-Math.Cos(offsetAngle) * 7f), mod.ProjectileType("AstralFlame"), laserDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - else if ((npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode) || npc.ai[0] == 2f) //falling and walking - { - float num179 = 18.5f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num185 = mod.ProjectileType("AstralLaser"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 5; num186++) - { - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-60, 61); - num182 += (float)Main.rand.Next(-60, 61); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, laserDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - if (npc.ai[0] == 0f) //start up - { - npc.damage = 0; - npc.ai[1] += 1f; - if (npc.justHit || npc.ai[1] >= 60f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) //use idle frames and regain fuel, become vulnerable - { - npc.damage = 0; - npc.defense = 0; - npc.velocity.X *= 0.98f; - npc.velocity.Y *= 0.98f; - npc.ai[1] += 1f; - if (npc.ai[1] >= ((npc.life < npc.lifeMax / 4 || npc.GetGlobalNPC(mod).enraged) ? 90f : 150f)) - { - npc.defense = 120; - npc.noGravity = true; - npc.noTileCollide = true; - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) //walk around and fire astral flames and lasers - { - npc.damage = expertMode ? 144 : 90; - float num823 = 4.5f; - bool flag51 = false; - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num823 = 5.5f; - } - if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) - { - num823 = 7f; - } - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 200f) - { - flag51 = true; - } - if (flag51) - { - npc.velocity.X = npc.velocity.X * 0.9f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - { - npc.velocity.X = 0f; - } - } - else - { - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = (playerLocation < 0 ? 1 : -1); - if (npc.direction > 0) - { - npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; - } - if (npc.direction < 0) - { - npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; - } - } - int num854 = 80; - int num855 = 20; - Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); - bool flag52 = false; - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y + (float)Main.player[npc.target].height - 16f) - { - flag52 = true; - } - if (flag52) - { - npc.velocity.Y = npc.velocity.Y + 0.5f; - } - else if (Collision.SolidCollision(position2, num854, num855)) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = 0f; - } - if ((double)npc.velocity.Y > -0.2) - { - npc.velocity.Y = npc.velocity.Y - 0.025f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.2f; - } - if (npc.velocity.Y < -4f) - { - npc.velocity.Y = -4f; - } - } - else - { - if (npc.velocity.Y < 0f) - { - npc.velocity.Y = 0f; - } - if ((double)npc.velocity.Y < 0.1) - { - npc.velocity.Y = npc.velocity.Y + 0.025f; - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.5f; - } - } - npc.ai[1] += 1f; - if (npc.ai[1] >= 360f) - { - npc.noGravity = false; - npc.noTileCollide = false; - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - } - else if (npc.ai[0] == 3f) //leap upwards - { - npc.damage = expertMode ? 144 : 90; - npc.noTileCollide = false; - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.8f; - npc.ai[1] += 1f; - if (npc.ai[1] > 0f) - { - npc.ai[1] += 1f; - } - if (npc.ai[1] >= 60f) //120 - { - npc.ai[1] = -20f; - } - else if (npc.ai[1] == -1f) - { - npc.TargetClosest(true); - npc.velocity.X = (float)(4 * npc.direction); //4 - npc.velocity.Y = -14.5f; //12.1 - npc.ai[0] = 4f; - npc.ai[1] = 0f; - } - } - } - else if (npc.ai[0] == 4f) //stomp - { - npc.damage = expertMode ? 144 : 90; - if (npc.velocity.Y == 0f) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LegStomp"), (int)npc.position.X, (int)npc.position.Y); - npc.ai[2] += 1f; - if (npc.ai[2] >= 2f) - { - npc.ai[0] = ((npc.life < npc.lifeMax / 2 || revenge) ? 5f : 1f); - npc.ai[2] = 0f; - } - else - { - npc.ai[0] = 3f; - } - for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) - { - for (int num623 = 0; num623 < 4; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + (float)npc.height), npc.width + 20, 4, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num624].velocity *= 0.2f; - } - } - } - else - { - npc.TargetClosest(true); - if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width) - { - npc.velocity.X = npc.velocity.X * 0.9f; - npc.velocity.Y = npc.velocity.Y + 0.6f; //0.2 - } - else - { - if (npc.direction < 0) - { - npc.velocity.X = npc.velocity.X - 0.2f; - } - else if (npc.direction > 0) - { - npc.velocity.X = npc.velocity.X + 0.2f; - } - float num626 = 8f; //4 - if (revenge) - { - num626 += 1f; - } - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - num626 += 2f; - } - if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) - { - num626 += 1f; - } - if (npc.life < npc.lifeMax / 10 || CalamityWorld.bossRushActive) - { - num626 += 1f; - } - if (npc.velocity.X < -num626) - { - npc.velocity.X = -num626; - } - if (npc.velocity.X > num626) - { - npc.velocity.X = num626; - } - } - } - } - else if (npc.ai[0] == 5f) //start teleport and summon minions, jump a bit - { - npc.velocity.X *= 0.95f; - npc.velocity.Y *= 0.95f; - npc.chaseable = true; - npc.dontTakeDamage = false; - if (Main.netMode != 1) - { - npc.localAI[1] += 1f; - if (!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] += 5f; - } - if (npc.localAI[1] >= 60f) - { - npc.damage = expertMode ? 144 : 90; - } - if (npc.localAI[1] >= 240f) - { - bool spawnFlag = revenge; - if (NPC.CountNPCS(mod.NPCType("AstrageldonSlime")) > 1) - { - spawnFlag = false; - } - if (spawnFlag && Main.netMode != 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, mod.NPCType("AstrageldonSlime"), 0, 0f, 0f, 0f, 0f, 255); - } - npc.localAI[1] = 0f; - npc.TargetClosest(true); - int num1249 = 0; - int num1250; - int num1251; - while (true) - { - num1249++; - num1250 = (int)Main.player[npc.target].Center.X / 16; - num1251 = (int)Main.player[npc.target].Center.Y / 16; - num1250 += Main.rand.Next(-30, 31); - num1251 += Main.rand.Next(-30, 31); - if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - break; - } - if (num1249 > 100) - { - goto Block; - } - } - npc.ai[0] = 6f; - npc.ai[3] = (float)num1250; - npc.localAI[2] = (float)num1251; - npc.netUpdate = true; - Block:; - } - } - } - else if (npc.ai[0] == 6f) //mid-teleport - { - npc.damage = 0; - npc.chaseable = false; - npc.dontTakeDamage = true; - npc.alpha += 10; - if (npc.alpha >= 255) - { - npc.alpha = 255; - npc.position.X = npc.ai[3] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.localAI[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 7f; - npc.netUpdate = true; - } - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); - } - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) - { - int num244 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default(Color), 2f); - Main.dust[num244].noGravity = true; - Main.dust[num244].velocity *= 0.5f; - num = num245; - } - } - else if (npc.ai[0] == 7f) //end teleport - { - npc.alpha -= 10; - if (npc.alpha <= 0) - { - bool spawnFlag = revenge; - if (NPC.CountNPCS(mod.NPCType("AstrageldonSlime")) > 1) - { - spawnFlag = false; - } - if (spawnFlag && Main.netMode != 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, mod.NPCType("AstrageldonSlime"), 0, 0f, 0f, 0f, 0f, 255); - } - npc.chaseable = true; - npc.dontTakeDamage = false; - npc.alpha = 0; - npc.ai[0] = 1f; - npc.netUpdate = true; - } - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); - } - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) - { - int num244 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default(Color), 2f); - Main.dust[num244].noGravity = true; - Main.dust[num244].velocity *= 0.5f; - num = num245; - } - } + bool dayTime = Main.dayTime; + Player player = Main.player[npc.target]; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + if (!player.active || player.dead || dayTime) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (!player.active || player.dead) + { + npc.noTileCollide = true; + npc.velocity = new Vector2(0f, 10f); + if (npc.timeLeft > 150) + { + npc.timeLeft = 150; + } + return; + } + } + else + { + if (npc.timeLeft < 1800) + { + npc.timeLeft = 1800; + } + } + if (npc.ai[0] != 1f) //emit light when not recharging + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 2.55f, 1f, 0f); + } + if (npc.ai[0] == 2f || npc.ai[0] >= 5f || (npc.ai[0] == 4f && npc.velocity.Y > 0f) || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) //fire fast, latent homing, projectiles while walking. lasers in a circle pattern while teleporting + { + if (Main.netMode != 1) + { + npc.localAI[0] += ((npc.ai[0] == 2f || (npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode)) ? 4f : shootTimer); + if (npc.localAI[0] >= 180f) //6 seconds 3 seconds 2 seconds + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + int laserDamage = expertMode ? 35 : 45; //180 120 + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 33); + if (NPC.downedMoonlord && revenge && !CalamityWorld.bossRushActive) + { + laserDamage *= 3; + } + if ((npc.ai[0] >= 5f && npc.ai[0] != 7) || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) //teleporting + { + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 7f), + (float)(Math.Cos(offsetAngle) * 7f), mod.ProjectileType("AstralFlame"), laserDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 7f), + (float)(-Math.Cos(offsetAngle) * 7f), mod.ProjectileType("AstralFlame"), laserDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + else if ((npc.ai[0] == 4f && npc.velocity.Y > 0f && expertMode) || npc.ai[0] == 2f) //falling and walking + { + float num179 = 18.5f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num185 = mod.ProjectileType("AstralLaser"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 5; num186++) + { + num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-60, 61); + num182 += (float)Main.rand.Next(-60, 61); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, laserDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + if (npc.ai[0] == 0f) //start up + { + npc.ai[1] += 1f; + if (npc.justHit || npc.ai[1] >= 60f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 1f) //use idle frames and regain fuel, become vulnerable + { + npc.defense = 0; + npc.velocity.X *= 0.98f; + npc.velocity.Y *= 0.98f; + npc.ai[1] += 1f; + if (npc.ai[1] >= ((npc.life < npc.lifeMax / 4 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 90f : 150f)) + { + npc.defense = 120; + npc.noGravity = true; + npc.noTileCollide = true; + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 2f) //walk around and fire astral flames and lasers + { + float num823 = 4.5f; + bool flag51 = false; + if ((double)npc.life < (double)npc.lifeMax * 0.5) + { + num823 = 5.5f; + } + if ((double)npc.life < (double)npc.lifeMax * 0.1 || CalamityWorld.bossRushActive) + { + num823 = 7f; + } + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 200f) + { + flag51 = true; + } + if (flag51) + { + npc.velocity.X = npc.velocity.X * 0.9f; + if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) + { + npc.velocity.X = 0f; + } + } + else + { + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + npc.direction = (playerLocation < 0 ? 1 : -1); + if (npc.direction > 0) + { + npc.velocity.X = (npc.velocity.X * 20f + num823) / 21f; + } + if (npc.direction < 0) + { + npc.velocity.X = (npc.velocity.X * 20f - num823) / 21f; + } + } + int num854 = 80; + int num855 = 20; + Vector2 position2 = new Vector2(npc.Center.X - (float)(num854 / 2), npc.position.Y + (float)npc.height - (float)num855); + bool flag52 = false; + if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y + (float)Main.player[npc.target].height - 16f) + { + flag52 = true; + } + if (flag52) + { + npc.velocity.Y = npc.velocity.Y + 0.5f; + } + else if (Collision.SolidCollision(position2, num854, num855)) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = 0f; + } + if ((double)npc.velocity.Y > -0.2) + { + npc.velocity.Y = npc.velocity.Y - 0.025f; + } + else + { + npc.velocity.Y = npc.velocity.Y - 0.2f; + } + if (npc.velocity.Y < -4f) + { + npc.velocity.Y = -4f; + } + } + else + { + if (npc.velocity.Y < 0f) + { + npc.velocity.Y = 0f; + } + if ((double)npc.velocity.Y < 0.1) + { + npc.velocity.Y = npc.velocity.Y + 0.025f; + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.5f; + } + } + npc.ai[1] += 1f; + if (npc.ai[1] >= 360f) + { + npc.noGravity = false; + npc.noTileCollide = false; + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + } + else if (npc.ai[0] == 3f) //leap upwards + { + npc.noTileCollide = false; + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.8f; + npc.ai[1] += 1f; + if (npc.ai[1] > 0f) + { + npc.ai[1] += 1f; + } + if (npc.ai[1] >= 60f) //120 + { + npc.ai[1] = -20f; + } + else if (npc.ai[1] == -1f) + { + npc.TargetClosest(true); + npc.velocity.X = (float)(4 * npc.direction); //4 + npc.velocity.Y = -14.5f; //12.1 + npc.ai[0] = 4f; + npc.ai[1] = 0f; + } + } + } + else if (npc.ai[0] == 4f) //stomp + { + if (npc.velocity.Y == 0f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LegStomp"), (int)npc.position.X, (int)npc.position.Y); + npc.ai[2] += 1f; + if (npc.ai[2] >= 2f) + { + npc.ai[0] = ((npc.life < npc.lifeMax / 2 || revenge) ? 5f : 1f); + npc.ai[2] = 0f; + } + else + { + npc.ai[0] = 3f; + } + for (int num622 = (int)npc.position.X - 20; num622 < (int)npc.position.X + npc.width + 40; num622 += 20) + { + for (int num623 = 0; num623 < 4; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + (float)npc.height), npc.width + 20, 4, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num624].velocity *= 0.2f; + } + } + } + else + { + npc.TargetClosest(true); + if (npc.position.X < player.position.X && npc.position.X + (float)npc.width > player.position.X + (float)player.width) + { + npc.velocity.X = npc.velocity.X * 0.9f; + npc.velocity.Y = npc.velocity.Y + 0.6f; //0.2 + } + else + { + if (npc.direction < 0) + { + npc.velocity.X = npc.velocity.X - 0.2f; + } + else if (npc.direction > 0) + { + npc.velocity.X = npc.velocity.X + 0.2f; + } + float num626 = 8f; //4 + if (revenge) + { + num626 += 1f; + } + if (CalamityWorld.death || CalamityWorld.bossRushActive) + { + num626 += 2f; + } + if (npc.life < npc.lifeMax / 2 || CalamityWorld.bossRushActive) + { + num626 += 1f; + } + if (npc.life < npc.lifeMax / 10 || CalamityWorld.bossRushActive) + { + num626 += 1f; + } + if (npc.velocity.X < -num626) + { + npc.velocity.X = -num626; + } + if (npc.velocity.X > num626) + { + npc.velocity.X = num626; + } + } + } + } + else if (npc.ai[0] == 5f) //start teleport and summon minions, jump a bit + { + npc.velocity.X *= 0.95f; + npc.velocity.Y *= 0.95f; + npc.chaseable = true; + npc.dontTakeDamage = false; + if (Main.netMode != 1) + { + npc.localAI[1] += 1f; + if (!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] += 5f; + } + if (npc.localAI[1] >= 240f) + { + bool spawnFlag = revenge; + if (NPC.CountNPCS(mod.NPCType("AstrageldonSlime")) > 1) + { + spawnFlag = false; + } + if (spawnFlag && Main.netMode != 1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, mod.NPCType("AstrageldonSlime"), 0, 0f, 0f, 0f, 0f, 255); + } + npc.localAI[1] = 0f; + npc.TargetClosest(true); + int num1249 = 0; + int num1250; + int num1251; + while (true) + { + num1249++; + num1250 = (int)Main.player[npc.target].Center.X / 16; + num1251 = (int)Main.player[npc.target].Center.Y / 16; + num1250 += Main.rand.Next(-30, 31); + num1251 += Main.rand.Next(-30, 31); + if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2((float)(num1250 * 16), (float)(num1251 * 16)), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + break; + } + if (num1249 > 100) + { + goto Block; + } + } + npc.ai[0] = 6f; + npc.ai[3] = (float)num1250; + npc.localAI[2] = (float)num1251; + npc.netUpdate = true; + Block:; + } + } + } + else if (npc.ai[0] == 6f) //mid-teleport + { + npc.chaseable = false; + npc.dontTakeDamage = true; + npc.alpha += 10; + if (npc.alpha >= 255) + { + npc.alpha = 255; + npc.position.X = npc.ai[3] * 16f - (float)(npc.width / 2); + npc.position.Y = npc.localAI[2] * 16f - (float)(npc.height / 2); + npc.ai[0] = 7f; + npc.netUpdate = true; + } + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); + } + int num; + for (int num245 = 0; num245 < 10; num245 = num + 1) + { + int num244 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default(Color), 2f); + Main.dust[num244].noGravity = true; + Main.dust[num244].velocity *= 0.5f; + num = num245; + } + } + else if (npc.ai[0] == 7f) //end teleport + { + npc.alpha -= 10; + if (npc.alpha <= 0) + { + bool spawnFlag = revenge; + if (NPC.CountNPCS(mod.NPCType("AstrageldonSlime")) > 1) + { + spawnFlag = false; + } + if (spawnFlag && Main.netMode != 1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y - 25, mod.NPCType("AstrageldonSlime"), 0, 0f, 0f, 0f, 0f, 255); + } + npc.chaseable = true; + npc.dontTakeDamage = false; + npc.alpha = 0; + npc.ai[0] = 1f; + npc.netUpdate = true; + } + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); + } + int num; + for (int num245 = 0; num245 < 10; num245 = num + 1) + { + int num244 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default(Color), 2f); + Main.dust[num244].noGravity = true; + Main.dust[num244].velocity *= 0.5f; + num = num245; + } + } } - public override void FindFrame(int frameHeight) - { - if (npc.ai[0] == 3f || npc.ai[0] == 4f) - { - if (npc.velocity.Y == 0f && npc.ai[1] >= 0f && npc.ai[0] == 3f) //idle before jump - { - if (npc.localAI[3] > 0f) - { - npc.localAI[3] = 0f; - npc.netUpdate = true; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 6) - { - npc.frame.Y = 0; - } - } - else if (npc.velocity.Y <= 0f || npc.ai[1] < 0f) //prepare to jump and then jump - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 5) - { - npc.frame.Y = frameHeight * 5; - } - } - else //stomping - { - if (npc.localAI[3] == 0f) - { - npc.localAI[3] = 1f; - npc.frameCounter = 0.0; - npc.frame.Y = 0; - npc.netUpdate = true; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 5) - { - npc.frame.Y = frameHeight * 5; - } - } - } - else if (npc.ai[0] >= 5f) - { - if (npc.localAI[3] > 0f) - { - npc.localAI[3] = 0f; - npc.netUpdate = true; - } - if (npc.velocity.Y == 0f) //idle before teleport - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 6) - { - npc.frame.Y = 0; - } - } - else //in-air - { - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 5) - { - npc.frame.Y = frameHeight * 5; - } - } - } - else - { - if (npc.localAI[3] > 0f) - { - npc.localAI[3] = 0f; - npc.netUpdate = true; - } - npc.frameCounter += 1.0; - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 6) - { - npc.frame.Y = 0; - } - } - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return (npc.alpha == 0 && npc.ai[0] > 1f); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) - { - Mod mod = ModLoader.GetMod("CalamityMod"); - Texture2D NPCTexture = Main.npcTexture[npc.type]; - Texture2D GlowMaskTexture = Main.npcTexture[npc.type]; - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } + public override void FindFrame(int frameHeight) + { + if (npc.ai[0] == 3f || npc.ai[0] == 4f) + { + if (npc.velocity.Y == 0f && npc.ai[1] >= 0f && npc.ai[0] == 3f) //idle before jump + { + if (npc.localAI[3] > 0f) + { + npc.localAI[3] = 0f; + npc.netUpdate = true; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 6) + { + npc.frame.Y = 0; + } + } + else if (npc.velocity.Y <= 0f || npc.ai[1] < 0f) //prepare to jump and then jump + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = frameHeight * 5; + } + } + else //stomping + { + if (npc.localAI[3] == 0f) + { + npc.localAI[3] = 1f; + npc.frameCounter = 0.0; + npc.frame.Y = 0; + npc.netUpdate = true; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = frameHeight * 5; + } + } + } + else if (npc.ai[0] >= 5f) + { + if (npc.localAI[3] > 0f) + { + npc.localAI[3] = 0f; + npc.netUpdate = true; + } + if (npc.velocity.Y == 0f) //idle before teleport + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 6) + { + npc.frame.Y = 0; + } + } + else //in-air + { + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = frameHeight * 5; + } + } + } + else + { + if (npc.localAI[3] > 0f) + { + npc.localAI[3] = 0f; + npc.netUpdate = true; + } + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 6) + { + npc.frame.Y = 0; + } + } + } - if (npc.ai[0] == 0f) - { - NPCTexture = Main.npcTexture[npc.type]; - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonGlow"); - } - else if (npc.ai[0] == 1f) //nothing special done here - { - NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonRecharge"); - } - else if (npc.ai[0] == 2f) //nothing special done here - { - NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonWalk"); - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonWalkGlow"); - } - else if (npc.ai[0] == 3f || npc.ai[0] == 4f) //needs to have an in-air frame - { - if (npc.velocity.Y == 0f && npc.ai[1] >= 0f && npc.ai[0] == 3f) //idle before jump - { - NPCTexture = Main.npcTexture[npc.type]; //idle frames - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonGlow"); - } - else if (npc.velocity.Y <= 0f || npc.ai[1] < 0f) //jump frames if flying upward or if about to jump - { - NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJump"); - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJumpGlow"); - } - else //stomping - { - NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonStomp"); - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonStompGlow"); - } - } - else if (npc.ai[0] >= 5f) //needs to have an in-air frame - { - if (npc.velocity.Y == 0f) //idle before teleport - { - NPCTexture = Main.npcTexture[npc.type]; //idle frames - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonGlow"); - } - else //in-air frames - { - NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJump"); - GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJumpGlow"); - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Texture2D NPCTexture = Main.npcTexture[npc.type]; + Texture2D GlowMaskTexture = Main.npcTexture[npc.type]; + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Color lightColor = (drawColor != null ? (Color)drawColor : CalamityMod.GetNPCColor(((NPC)npc), npc.Center, false)); - int frameCount = Main.npcFrameCount[npc.type]; - Microsoft.Xna.Framework.Rectangle frame = npc.frame; - float scale = npc.scale; - float rotation = npc.rotation; - float offsetY = npc.gfxOffY; + if (npc.ai[0] == 0f) + { + NPCTexture = Main.npcTexture[npc.type]; + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonGlow"); + } + else if (npc.ai[0] == 1f) //nothing special done here + { + NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonRecharge"); + } + else if (npc.ai[0] == 2f) //nothing special done here + { + NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonWalk"); + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonWalkGlow"); + } + else if (npc.ai[0] == 3f || npc.ai[0] == 4f) //needs to have an in-air frame + { + if (npc.velocity.Y == 0f && npc.ai[1] >= 0f && npc.ai[0] == 3f) //idle before jump + { + NPCTexture = Main.npcTexture[npc.type]; //idle frames + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonGlow"); + } + else if (npc.velocity.Y <= 0f || npc.ai[1] < 0f) //jump frames if flying upward or if about to jump + { + NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJump"); + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJumpGlow"); + } + else //stomping + { + NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonStomp"); + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonStompGlow"); + } + } + else if (npc.ai[0] >= 5f) //needs to have an in-air frame + { + if (npc.velocity.Y == 0f) //idle before teleport + { + NPCTexture = Main.npcTexture[npc.type]; //idle frames + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonGlow"); + } + else //in-air frames + { + NPCTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJump"); + GlowMaskTexture = mod.GetTexture("NPCs/Astrageldon/AstrageldonJumpGlow"); + } + } - Main.spriteBatch.Draw(NPCTexture, - new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * scale / 2f + vector11.X * scale, - npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * scale + 0f + offsetY), - new Microsoft.Xna.Framework.Rectangle?(frame), - npc.GetAlpha(lightColor), - rotation, - vector11, - scale, - spriteEffects, - 0f); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + int frameCount = Main.npcFrameCount[npc.type]; + Microsoft.Xna.Framework.Rectangle frame = npc.frame; + float scale = npc.scale; + float rotation = npc.rotation; + float offsetY = npc.gfxOffY; + + Main.spriteBatch.Draw(NPCTexture, + new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * scale / 2f + vector11.X * scale, + npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * scale + 0f + offsetY), + new Microsoft.Xna.Framework.Rectangle?(frame), + npc.GetAlpha(drawColor), + rotation, + vector11, + scale, + spriteEffects, + 0f); if (npc.ai[0] != 1) //draw only if not recharging - { - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y - 30f); //30 - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)GlowMaskTexture.Width, (float)(GlowMaskTexture.Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + offsetY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); + { + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y - 30f); //30 + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)GlowMaskTexture.Width, (float)(GlowMaskTexture.Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + offsetY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); Main.spriteBatch.Draw(GlowMaskTexture, vector, - new Microsoft.Xna.Framework.Rectangle?(frame), color, rotation, vector11, 1f, spriteEffects, 0f); + new Microsoft.Xna.Framework.Rectangle?(frame), color, rotation, vector11, 1f, spriteEffects, 0f); } - return false; - } + return false; + } - public override void BossLoot(ref string name, ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } - - public override void NPCLoot() + public override void BossLoot(ref string name, ref int potionType) { - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstrageldonTrophy")); - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstralJelly"), Main.rand.Next(9, 13)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(20, 31)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FallenStar, Main.rand.Next(25, 41)); + potionType = ItemID.GreaterHealingPotion; + } + + public override void NPCLoot() + { + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstrageldonTrophy")); + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstralJelly"), Main.rand.Next(9, 13)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(20, 31)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FallenStar, Main.rand.Next(25, 41)); if (Main.rand.Next(7) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AureusMask")); } } - if (NPC.downedMoonlord) - { - int amount = Main.rand.Next(25, 41) / 2; - if (Main.expertMode) - { - amount = (int)((float)amount * 1.5f); - } - for (int i = 0; i < amount; i++) - { - Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3459, Main.rand.Next(1, 4), false, 0, false, false); - } - for (int i = 0; i < amount; i++) - { - Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3458, Main.rand.Next(1, 4), false, 0, false, false); - } - for (int i = 0; i < amount; i++) - { - Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3457, Main.rand.Next(1, 4), false, 0, false, false); - } - for (int i = 0; i < amount; i++) - { - Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3456, Main.rand.Next(1, 4), false, 0, false, false); - } - } - } - + if (NPC.downedMoonlord) + { + int amount = Main.rand.Next(25, 41) / 2; + if (Main.expertMode) + { + amount = (int)((float)amount * 1.5f); + } + for (int i = 0; i < amount; i++) + { + Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3459, Main.rand.Next(1, 4), false, 0, false, false); + } + for (int i = 0; i < amount; i++) + { + Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3458, Main.rand.Next(1, 4), false, 0, false, false); + } + for (int i = 0; i < amount; i++) + { + Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3457, Main.rand.Next(1, 4), false, 0, false, false); + } + for (int i = 0; i < amount; i++) + { + Item.NewItem((int)npc.position.X + Main.rand.Next(npc.width), (int)npc.position.Y + Main.rand.Next(npc.height), 2, 2, 3456, Main.rand.Next(1, 4), false, 0, false, false); + } + } + } + public override void HitEffect(int hitDirection, double damage) { - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstrumAureusHit"), npc.Center); - } + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstrumAureusHit"), npc.Center); + } - for (int k = 0; k < 5; k++) + for (int k = 0; k < 5; k++) { Dust.NewDust(npc.position, npc.width, npc.height, 173, hitDirection, -1f, 0, default(Color), 1f); } @@ -813,13 +809,13 @@ namespace CalamityMod.NPCs.Astrageldon } } } - + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); npc.damage = (int)(npc.damage * 0.8f); } - + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); diff --git a/NPCs/Astrageldon/AstrageldonSlime.cs b/NPCs/Astrageldon/AstrageldonSlime.cs index 27a4a158c0..498d157f66 100644 --- a/NPCs/Astrageldon/AstrageldonSlime.cs +++ b/NPCs/Astrageldon/AstrageldonSlime.cs @@ -12,206 +12,206 @@ namespace CalamityMod.NPCs.Astrageldon { public class AstrageldonSlime : ModNPC { - private bool boostDR = false; + private bool boostDR = false; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Aureus Spawn"); Main.npcFrameCount[npc.type] = 4; } - + public override void SetDefaults() { npc.aiStyle = -1; - aiType = -1; + aiType = -1; npc.damage = 0; npc.width = 90; //324 npc.height = 60; //216 npc.defense = 0; - npc.alpha = 255; + npc.alpha = 255; npc.lifeMax = Main.expertMode ? 1007 : 1012; - if (CalamityWorld.death) - { - npc.lifeMax = 1002; - } + if (CalamityWorld.death) + { + npc.lifeMax = 1002; + } npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.noGravity = true; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - } + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.25f, 0f); - npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.04f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (npc.alpha > 0) - { - npc.alpha -= 5; - int num; - for (int num245 = 0; num245 < 10; num245 = num + 1) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default(Color), 0.8f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - num = num245; - } - } - npc.TargetClosest(true); - if (npc.life <= 1000 || Main.dayTime) - { - npc.dontTakeDamage = true; - Vector2 vector = Main.player[npc.target].Center - npc.Center; - Point point15 = npc.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(point15); - bool flag121 = (tileSafely.nactive() && Main.tileSolid[tileSafely.type] && !TileID.Sets.Platforms[tileSafely.type]); - if (vector.Length() < 60f || flag121) - { - npc.dontTakeDamage = false; - CheckDead(); - npc.life = 0; - return; - } - float num1372 = 18f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; - float num1374 = Main.player[npc.target].Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); - float num1376 = num1372 / num1375; - num1373 *= num1376; - num1374 *= num1376; - npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; - npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; - return; - } - float num1446 = 7f; - int num1447 = 480; - float num244; - if (npc.localAI[1] == 1f) - { - npc.localAI[1] = 0f; - if (Main.rand.Next(4) == 0) - { - npc.ai[0] = (float)num1447; - } - } - Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); - Vector2 vector251 = Main.player[npc.target].Center - value53; - bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - if (vector251.Length() > 400f || !flag104) - { - Vector2 value54 = vector251; - if (value54.Length() > num1446) - { - value54.Normalize(); - value54 *= num1446; - } - int num1448 = 30; - npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; - } - else - { - npc.velocity *= 0.98f; - } - if (npc.ai[2] != 0f && npc.ai[3] != 0f) - { - Main.PlaySound(SoundID.Item8, npc.Center); - int num; - for (int num1449 = 0; num1449 < 20; num1449 = num + 1) - { - int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, Color.Transparent, 0.6f); - Dust dust = Main.dust[num1450]; - dust.velocity *= 3f; - Main.dust[num1450].noGravity = true; - Main.dust[num1450].scale = 2.5f; - num = num1449; - } - if (npc.localAI[0] >= 260f) - { - npc.localAI[0] -= 60f; - } - npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); - npc.velocity = Vector2.Zero; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - Main.PlaySound(SoundID.Item8, npc.Center); - for (int num1451 = 0; num1451 < 20; num1451 = num + 1) - { - int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, Color.Transparent, 0.6f); - Dust dust = Main.dust[num1452]; - dust.velocity *= 3f; - Main.dust[num1452].noGravity = true; - Main.dust[num1452].scale = 2.5f; - num = num1451; - } - } - float[] var_9_48E3C_cp_0 = npc.ai; - int var_9_48E3C_cp_1 = 0; - num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; - var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; - if (npc.ai[0] >= (float)num1447 && Main.netMode != 1) - { - npc.ai[0] = 0f; - Point point12 = npc.Center.ToTileCoordinates(); - Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); - int num1453 = 20; - int num1454 = 3; - int num1455 = 10; - int num1456 = 1; - int num1457 = 0; - bool flag106 = false; - if (vector251.Length() > 2000f) - { - flag106 = true; - } - while (!flag106 && num1457 < 100) - { - num1457++; - int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); - int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); - if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) - { - bool flag107 = true; - if (flag107 && Main.tile[num1458, num1459].lava()) - { - flag107 = false; - } - if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) - { - flag107 = false; - } - if (flag107) - { - npc.ai[2] = (float)num1458; - npc.ai[3] = (float)num1459; - break; - } - } - } - npc.netUpdate = true; - } - } + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.25f, 0f); + npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.04f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + if (npc.alpha > 0) + { + npc.alpha -= 5; + int num; + for (int num245 = 0; num245 < 10; num245 = num + 1) + { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), npc.velocity.X, npc.velocity.Y, 255, default(Color), 0.8f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.5f; + num = num245; + } + } + npc.TargetClosest(true); + if (npc.life <= 1000 || Main.dayTime) + { + npc.dontTakeDamage = true; + Vector2 vector = Main.player[npc.target].Center - npc.Center; + Point point15 = npc.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point15); + bool flag121 = (tileSafely.nactive() && Main.tileSolid[tileSafely.type] && !Main.tileSolidTop[tileSafely.type] && !TileID.Sets.Platforms[tileSafely.type]); + if (vector.Length() < 60f || flag121) + { + npc.dontTakeDamage = false; + CheckDead(); + npc.life = 0; + return; + } + float num1372 = 18f; + Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); + float num1373 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector167.X; + float num1374 = Main.player[npc.target].Center.Y - vector167.Y; + float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1376 = num1372 / num1375; + num1373 *= num1376; + num1374 *= num1376; + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; + return; + } + float num1446 = 7f; + int num1447 = 480; + float num244; + if (npc.localAI[1] == 1f) + { + npc.localAI[1] = 0f; + if (Main.rand.Next(4) == 0) + { + npc.ai[0] = (float)num1447; + } + } + Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); + Vector2 vector251 = Main.player[npc.target].Center - value53; + bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + if (vector251.Length() > 400f || !flag104) + { + Vector2 value54 = vector251; + if (value54.Length() > num1446) + { + value54.Normalize(); + value54 *= num1446; + } + int num1448 = 30; + npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; + } + else + { + npc.velocity *= 0.98f; + } + if (npc.ai[2] != 0f && npc.ai[3] != 0f) + { + Main.PlaySound(SoundID.Item8, npc.Center); + int num; + for (int num1449 = 0; num1449 < 20; num1449 = num + 1) + { + int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, Color.Transparent, 0.6f); + Dust dust = Main.dust[num1450]; + dust.velocity *= 3f; + Main.dust[num1450].noGravity = true; + Main.dust[num1450].scale = 2.5f; + num = num1449; + } + if (npc.localAI[0] >= 260f) + { + npc.localAI[0] -= 60f; + } + npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); + npc.velocity = Vector2.Zero; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + Main.PlaySound(SoundID.Item8, npc.Center); + for (int num1451 = 0; num1451 < 20; num1451 = num + 1) + { + int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, Color.Transparent, 0.6f); + Dust dust = Main.dust[num1452]; + dust.velocity *= 3f; + Main.dust[num1452].noGravity = true; + Main.dust[num1452].scale = 2.5f; + num = num1451; + } + } + float[] var_9_48E3C_cp_0 = npc.ai; + int var_9_48E3C_cp_1 = 0; + num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; + var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; + if (npc.ai[0] >= (float)num1447 && Main.netMode != 1) + { + npc.ai[0] = 0f; + Point point12 = npc.Center.ToTileCoordinates(); + Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); + int num1453 = 20; + int num1454 = 3; + int num1455 = 10; + int num1456 = 1; + int num1457 = 0; + bool flag106 = false; + if (vector251.Length() > 2000f) + { + flag106 = true; + } + while (!flag106 && num1457 < 100) + { + num1457++; + int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); + int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); + if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) + { + bool flag107 = true; + if (flag107 && Main.tile[num1458, num1459].lava()) + { + flag107 = false; + } + if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) + { + flag107 = false; + } + if (flag107) + { + npc.ai[2] = (float)num1458; + npc.ai[3] = (float)num1459; + break; + } + } + } + npc.netUpdate = true; + } + } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - damage = (crit ? 2 : 1); - return false; - } + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + damage = (crit ? 2 : 1); + return false; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) @@ -227,36 +227,36 @@ namespace CalamityMod.NPCs.Astrageldon } } - public override bool CheckDead() - { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 14); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); - npc.damage = CalamityWorld.death ? 225 : 150; - npc.width = (npc.height = 216); - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 15; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); - Main.dust[num622].velocity *= 3f; - if (Main.rand.Next(2) == 0) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - Main.dust[num622].noGravity = true; - } - for (int num623 = 0; num623 < 30; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; - } - return true; - } - } + public override bool CheckDead() + { + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 14); + npc.position.X = npc.position.X + (float)(npc.width / 2); + npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.damage = CalamityWorld.death ? 225 : 150; + npc.width = (npc.height = 216); + npc.position.X = npc.position.X - (float)(npc.width / 2); + npc.position.Y = npc.position.Y - (float)(npc.height / 2); + for (int num621 = 0; num621 < 15; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + Main.dust[num622].noGravity = true; + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 173, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, mod.DustType("AstralOrange"), 0f, 0f, 100, default(Color), 1f); + Main.dust[num624].velocity *= 2f; + Main.dust[num624].noGravity = true; + } + return true; + } + } } \ No newline at end of file diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 6369e64496..dc7833166a 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -35,7 +35,9 @@ namespace CalamityMod.NPCs.AstrumDeus { npc.lifeMax = CalamityWorld.death ? 420000 : 360000; } - npc.aiStyle = 6; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; @@ -143,13 +145,13 @@ namespace CalamityMod.NPCs.AstrumDeus public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { + if (projectile.type == mod.ProjectileType("TerraFireGreen") || projectile.type == mod.ProjectileType("AtlantisSpear") || projectile.type == mod.ProjectileType("AtlantisSpear2")) + { + damage = (int)((double)damage * 0.66); + } if ((double)npc.life <= (double)npc.lifeMax * 0.33) { - damage = (int)((double)damage * 0.33f); - if (projectile.minion) - { - return; - } + damage = (int)((double)damage * 0.33); } else { diff --git a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs index bce43b18c2..fa58577073 100644 --- a/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusBodySpectral.cs @@ -35,7 +35,9 @@ namespace CalamityMod.NPCs.AstrumDeus { npc.lifeMax = CalamityWorld.death ? 1500000 : 1300000; } - npc.aiStyle = 6; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; @@ -204,13 +206,13 @@ namespace CalamityMod.NPCs.AstrumDeus public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if ((double)npc.life <= (double)npc.lifeMax * 0.33) + if (projectile.type == mod.ProjectileType("TerraFireGreen") || projectile.type == mod.ProjectileType("AtlantisSpear") || projectile.type == mod.ProjectileType("AtlantisSpear2")) + { + damage = (int)((double)damage * 0.66); + } + if ((double)npc.life <= (double)npc.lifeMax * 0.33) { - damage = (int)((double)damage * 0.33f); - if (projectile.minion) - { - return; - } + damage = (int)((double)damage * 0.33); } else { diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index b0d3a766eb..34d4faf337 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -49,6 +49,8 @@ namespace CalamityMod.NPCs.AstrumDeus { npc.lifeMax = CalamityWorld.death ? 420000 : 360000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new @@ -157,10 +159,10 @@ namespace CalamityMod.NPCs.AstrumDeus npc.TargetClosest(true); } npc.velocity.Length(); - float speedMult = expertMode ? 2f : 1.8f; + float speedMult = expertMode ? 1.8f : 1.6f; if (CalamityWorld.death || CalamityWorld.bossRushActive) { - speedMult = (npc.GetGlobalNPC(mod).enraged ? 2.8f : 2.5f); + speedMult = ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2.8f : 2.5f); } float life = (float)npc.life; float totalLife = (float)npc.lifeMax; @@ -260,7 +262,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.localAI[1] = 1f; Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); int rectX = 300; - int rectY = (npc.GetGlobalNPC(mod).enraged ? 100 : 200); + int rectY = ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 100 : 200); bool flag95 = true; if (npc.position.Y > Main.player[npc.target].position.Y) { diff --git a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs index 3f4c6ec8a9..286acf08a3 100644 --- a/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusHeadSpectral.cs @@ -46,6 +46,8 @@ namespace CalamityMod.NPCs.AstrumDeus { npc.lifeMax = CalamityWorld.death ? 1500000 : 1300000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new @@ -88,8 +90,8 @@ namespace CalamityMod.NPCs.AstrumDeus float turnSpeedLimit = CalamityWorld.revenge ? 0.14f : 0.12f; if (CalamityWorld.death || CalamityWorld.bossRushActive) { - speedLimit = (npc.GetGlobalNPC(mod).enraged ? 15f : 12f); - turnSpeedLimit = (npc.GetGlobalNPC(mod).enraged ? 0.2f : 0.16f); + speedLimit = ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 15f : 12f); + turnSpeedLimit = ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 0.2f : 0.16f); } float speedBoost = speedLimit * (1f - (float)((double)npc.life / (double)npc.lifeMax)); float turnSpeedBoost = turnSpeedLimit * (1f - (float)((double)npc.life / (double)npc.lifeMax)); @@ -181,10 +183,10 @@ namespace CalamityMod.NPCs.AstrumDeus { npc.TargetClosest(false); canFly = false; - npc.velocity.Y = npc.velocity.Y + 2f; + npc.velocity.Y = npc.velocity.Y + 5f; if ((double)npc.position.Y > Main.worldSurface * 16.0) { - npc.velocity.Y = npc.velocity.Y + 2f; + npc.velocity.Y = npc.velocity.Y + 5f; } if ((double)npc.position.Y > Main.rockLayer * 16.0) { diff --git a/NPCs/AstrumDeus/AstrumDeusProbe3.cs b/NPCs/AstrumDeus/AstrumDeusProbe3.cs index f8c901dae2..5d18d1b7ae 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe3.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe3.cs @@ -36,7 +36,6 @@ namespace CalamityMod.NPCs.AstrumDeus npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.buffImmune[24] = true; } @@ -209,6 +208,23 @@ namespace CalamityMod.NPCs.AstrumDeus public override void HitEffect(int hitDirection, double damage) { + if (npc.soundDelay == 0) + { + npc.soundDelay = 15; + switch (Main.rand.Next(3)) + { + case 0: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit"), npc.Center); + break; + case 1: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit2"), npc.Center); + break; + case 2: + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AstralEnemyHit3"), npc.Center); + break; + } + } + if (npc.life <= 0) { npc.position.X = npc.position.X + (float)(npc.width / 2); diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index b8808b579f..b2f1998470 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -33,6 +33,8 @@ namespace CalamityMod.NPCs.AstrumDeus { npc.lifeMax = CalamityWorld.death ? 420000 : 360000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new diff --git a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs index 667379374a..356740c2a8 100644 --- a/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs +++ b/NPCs/AstrumDeus/AstrumDeusTailSpectral.cs @@ -33,6 +33,8 @@ namespace CalamityMod.NPCs.AstrumDeus { npc.lifeMax = CalamityWorld.death ? 1500000 : 1300000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new diff --git a/NPCs/BrimstoneWaifu/Brimling.cs b/NPCs/BrimstoneWaifu/Brimling.cs index 26e2b75c82..0d20570012 100644 --- a/NPCs/BrimstoneWaifu/Brimling.cs +++ b/NPCs/BrimstoneWaifu/Brimling.cs @@ -12,254 +12,254 @@ namespace CalamityMod.NPCs.BrimstoneWaifu { public class Brimling : ModNPC { - private bool boostDR = false; + private bool boostDR = false; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Brimling"); Main.npcFrameCount[npc.type] = 8; } - + public override void SetDefaults() { npc.aiStyle = -1; - aiType = -1; + aiType = -1; npc.damage = 0; npc.width = 60; //324 npc.height = 60; //216 npc.defense = 0; npc.lifeMax = 4000; - if (CalamityWorld.death) - { - npc.lifeMax = 6000; - } + if (CalamityWorld.death) + { + npc.lifeMax = 6000; + } npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - } + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.noGravity = true; npc.noTileCollide = false; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit23; npc.DeathSound = SoundID.NPCDeath39; - if (CalamityWorld.downedProvidence) - { - npc.lifeMax = 40000; - } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 100000; - } - } + if (CalamityWorld.downedProvidence) + { + npc.lifeMax = 40000; + } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 100000; + } + } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0f, 0f); - bool goIntoShell = (double)npc.life <= (double)npc.lifeMax * 0.2; - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - if (goIntoShell || Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 4f) - { - boostDR = true; - npc.chaseable = false; - } - else - { - boostDR = false; - npc.chaseable = true; - } - npc.noTileCollide = true; - float num1446 = goIntoShell ? 1f : 6f; - int num1447 = 480; - float num244; - if (npc.localAI[1] == 1f) - { - npc.localAI[1] = 0f; - if (Main.rand.Next(4) == 0) - { - npc.ai[0] = (float)num1447; - } - } - npc.TargetClosest(true); - npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.1f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); - Vector2 vector251 = Main.player[npc.target].Center - value53; - bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - npc.localAI[0] += 1f; - if (Main.netMode != 1 && npc.localAI[0] >= 300f && Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] != 4f) - { - npc.localAI[0] = 0f; - 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 speed = 5f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-10, 11); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-10, 11); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int damage = 32; - if (Main.expertMode) - { - damage = 24; - } - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, mod.ProjectileType("BrimstoneHellfireball"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } - } - if (vector251.Length() > 400f || !flag104) - { - Vector2 value54 = vector251; - if (value54.Length() > num1446) - { - value54.Normalize(); - value54 *= num1446; - } - int num1448 = 30; - npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; - } - else - { - npc.velocity *= 0.98f; - } - if (npc.ai[2] != 0f && npc.ai[3] != 0f) - { - Main.PlaySound(SoundID.Item8, npc.Center); - int num; - for (int num1449 = 0; num1449 < 20; num1449 = num + 1) - { - int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1450]; - dust.velocity *= 3f; - Main.dust[num1450].noGravity = true; - Main.dust[num1450].scale = 2.5f; - num = num1449; - } - if (npc.localAI[0] >= 260f) - { - npc.localAI[0] -= 60f; - } - npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); - npc.velocity = Vector2.Zero; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - Main.PlaySound(SoundID.Item8, npc.Center); - for (int num1451 = 0; num1451 < 20; num1451 = num + 1) - { - int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1452]; - dust.velocity *= 3f; - Main.dust[num1452].noGravity = true; - Main.dust[num1452].scale = 2.5f; - num = num1451; - } - } - float[] var_9_48E3C_cp_0 = npc.ai; - int var_9_48E3C_cp_1 = 0; - num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; - var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; - if (npc.ai[0] >= (float)num1447 && Main.netMode != 1) - { - npc.ai[0] = 0f; - Point point12 = npc.Center.ToTileCoordinates(); - Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); - int num1453 = 20; - int num1454 = 3; - int num1455 = 10; - int num1456 = 1; - int num1457 = 0; - bool flag106 = false; - if (vector251.Length() > 2000f) - { - flag106 = true; - } - while (!flag106 && num1457 < 100) - { - num1457++; - int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); - int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); - if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) - { - bool flag107 = true; - if (flag107 && Main.tile[num1458, num1459].lava()) - { - flag107 = false; - } - if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) - { - flag107 = false; - } - if (flag107) - { - npc.ai[2] = (float)num1458; - npc.ai[3] = (float)num1459; - break; - } - } - } - npc.netUpdate = true; - } - } + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 1f, 0f, 0f); + bool goIntoShell = (double)npc.life <= (double)npc.lifeMax * 0.2; + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + if (goIntoShell || Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 4f) + { + boostDR = true; + npc.chaseable = false; + } + else + { + boostDR = false; + npc.chaseable = true; + } + npc.noTileCollide = true; + float num1446 = goIntoShell ? 1f : 6f; + int num1447 = 480; + float num244; + if (npc.localAI[1] == 1f) + { + npc.localAI[1] = 0f; + if (Main.rand.Next(4) == 0) + { + npc.ai[0] = (float)num1447; + } + } + npc.TargetClosest(true); + npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.1f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); + Vector2 vector251 = Main.player[npc.target].Center - value53; + bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + npc.localAI[0] += 1f; + if (Main.netMode != 1 && npc.localAI[0] >= 300f && Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] != 4f) + { + npc.localAI[0] = 0f; + 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 speed = 5f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-10, 11); + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-10, 11); + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + int damage = 32; + if (Main.expertMode) + { + damage = 24; + } + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, mod.ProjectileType("BrimstoneHellfireball"), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } + } + if (vector251.Length() > 400f || !flag104) + { + Vector2 value54 = vector251; + if (value54.Length() > num1446) + { + value54.Normalize(); + value54 *= num1446; + } + int num1448 = 30; + npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; + } + else + { + npc.velocity *= 0.98f; + } + if (npc.ai[2] != 0f && npc.ai[3] != 0f) + { + Main.PlaySound(SoundID.Item8, npc.Center); + int num; + for (int num1449 = 0; num1449 < 20; num1449 = num + 1) + { + int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[num1450]; + dust.velocity *= 3f; + Main.dust[num1450].noGravity = true; + Main.dust[num1450].scale = 2.5f; + num = num1449; + } + npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); + npc.velocity = Vector2.Zero; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + Main.PlaySound(SoundID.Item8, npc.Center); + for (int num1451 = 0; num1451 < 20; num1451 = num + 1) + { + int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[num1452]; + dust.velocity *= 3f; + Main.dust[num1452].noGravity = true; + Main.dust[num1452].scale = 2.5f; + num = num1451; + } + } + float[] var_9_48E3C_cp_0 = npc.ai; + int var_9_48E3C_cp_1 = 0; + num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; + var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; + if (npc.ai[0] >= (float)num1447 && Main.netMode != 1) + { + if (npc.localAI[0] > 260f) + { + npc.localAI[0] -= 60f; + } + npc.ai[0] = 0f; + Point point12 = npc.Center.ToTileCoordinates(); + Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); + int num1453 = 20; + int num1454 = 3; + int num1455 = 10; + int num1456 = 1; + int num1457 = 0; + bool flag106 = false; + if (vector251.Length() > 2000f) + { + flag106 = true; + } + while (!flag106 && num1457 < 100) + { + num1457++; + int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); + int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); + if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) + { + bool flag107 = true; + if (flag107 && Main.tile[num1458, num1459].lava()) + { + flag107 = false; + } + if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) + { + flag107 = false; + } + if (flag107) + { + npc.ai[2] = (float)num1458; + npc.ai[3] = (float)num1459; + break; + } + } + } + npc.netUpdate = true; + } + } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - double multiplier = 0.8; - if (boostDR) - { - multiplier = 0.2; - } - damage = (int)((double)damage * multiplier); - return true; - } + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + double multiplier = 0.8; + if (boostDR) + { + multiplier = 0.2; + } + damage = (int)((double)damage * multiplier); + return true; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (!boostDR) + { + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 4) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y < frameHeight * 4) + { + npc.frame.Y = frameHeight * 4; + } + if (npc.frame.Y >= frameHeight * 8) + { + npc.frame.Y = frameHeight * 4; + } + } + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (!boostDR) - { - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 4) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frameCounter > 12.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y < frameHeight * 4) - { - npc.frame.Y = frameHeight * 4; - } - if (npc.frame.Y >= frameHeight * 8) - { - npc.frame.Y = frameHeight * 4; - } - } - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/BrimstoneWaifu/BrimstoneElemental.cs b/NPCs/BrimstoneWaifu/BrimstoneElemental.cs index 0f12d75a9e..cb84ff7dba 100644 --- a/NPCs/BrimstoneWaifu/BrimstoneElemental.cs +++ b/NPCs/BrimstoneWaifu/BrimstoneElemental.cs @@ -38,21 +38,21 @@ namespace CalamityMod.NPCs.BrimstoneWaifu for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.boss = true; npc.noGravity = true; npc.noTileCollide = true; @@ -76,6 +76,8 @@ namespace CalamityMod.NPCs.BrimstoneWaifu { npc.lifeMax = CalamityWorld.death ? 2300000 : 2000000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); } public override void AI() @@ -122,7 +124,7 @@ namespace CalamityMod.NPCs.BrimstoneWaifu { npc.timeLeft = 1800; } - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { speed = 11f; } @@ -138,21 +140,15 @@ namespace CalamityMod.NPCs.BrimstoneWaifu { npc.rotation = npc.velocity.X * 0.04f; npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - if (totalDistance < speed) - { - npc.velocity.X = xDistance; - npc.velocity.Y = yDistance; - } - else - { - totalDistance = speed / totalDistance; - npc.velocity.X = xDistance * totalDistance; - npc.velocity.Y = yDistance * totalDistance; - } + totalDistance = speed / totalDistance; + xDistance *= totalDistance; + yDistance *= totalDistance; + npc.velocity.X = (npc.velocity.X * 50f + xDistance) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + yDistance) / 51f; } if (npc.ai[0] == 0f) { - npc.defense = 20; + npc.defense = provy ? 120 : 20; npc.chaseable = true; if (Main.netMode != 1) { @@ -194,9 +190,8 @@ namespace CalamityMod.NPCs.BrimstoneWaifu } else if (npc.ai[0] == 1f) { - npc.damage = 0; npc.dontTakeDamage = true; - npc.defense = 20; + npc.defense = provy ? 120 : 20; npc.chaseable = false; npc.alpha += (brimTeleport ? 5 : 4); if (npc.alpha >= 255) @@ -218,9 +213,8 @@ namespace CalamityMod.NPCs.BrimstoneWaifu npc.alpha -= (brimTeleport ? 5 : 4); if (npc.alpha <= 0) { - npc.damage = expertMode ? 96 : 60; npc.dontTakeDamage = false; - npc.defense = 20; + npc.defense = provy ? 120 : 20; npc.chaseable = true; npc.ai[3] += 1f; npc.alpha = 0; @@ -241,7 +235,7 @@ namespace CalamityMod.NPCs.BrimstoneWaifu } else if (npc.ai[0] == 3f) { - npc.defense = 20; + npc.defense = provy ? 120 : 20; npc.dontTakeDamage = false; npc.chaseable = true; npc.rotation = npc.velocity.X * 0.04f; @@ -249,7 +243,7 @@ namespace CalamityMod.NPCs.BrimstoneWaifu Vector2 shootFromVectorX = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); npc.ai[1] += 1f; bool shootProjectile = false; - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { if (npc.ai[1] % 10f == 9f) { @@ -286,7 +280,7 @@ namespace CalamityMod.NPCs.BrimstoneWaifu if (Main.netMode != 1) { float projectileSpeed = 6f; //changed from 10 - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { projectileSpeed += 4f; } @@ -384,7 +378,7 @@ namespace CalamityMod.NPCs.BrimstoneWaifu if (Main.netMode != 1) { npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { npc.localAI[0] += 3f; } @@ -450,11 +444,15 @@ namespace CalamityMod.NPCs.BrimstoneWaifu npc.ai[2] = 0f; npc.ai[3] = 0f; npc.netUpdate = true; - return; } } } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return npc.alpha == 0; + } + public override void OnHitPlayer(Player player, int damage, bool crit) { if (CalamityWorld.revenge) diff --git a/NPCs/Bumblefuck/Bumblefuck.cs b/NPCs/Bumblefuck/Bumblefuck.cs index 6200fab8ee..d2e48619d6 100644 --- a/NPCs/Bumblefuck/Bumblefuck.cs +++ b/NPCs/Bumblefuck/Bumblefuck.cs @@ -37,22 +37,24 @@ namespace CalamityMod.NPCs.Bumblefuck { npc.lifeMax = CalamityWorld.death ? 1000000 : 900000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.knockBackResist = 0f; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("ExoFreeze")] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("ExoFreeze")] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.boss = true; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) @@ -615,6 +617,10 @@ namespace CalamityMod.NPCs.Bumblefuck } else { + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Swordsplosion")); + } Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EffulgentFeather"), Main.rand.Next(6, 12)); switch (Main.rand.Next(3)) { diff --git a/NPCs/Bumblefuck/Bumblefuck2.cs b/NPCs/Bumblefuck/Bumblefuck2.cs index 69ace3642c..430ce5b7a7 100644 --- a/NPCs/Bumblefuck/Bumblefuck2.cs +++ b/NPCs/Bumblefuck/Bumblefuck2.cs @@ -37,10 +37,10 @@ namespace CalamityMod.NPCs.Bumblefuck for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("ExoFreeze")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("ExoFreeze")] = false; npc.lavaImmune = true; npc.noGravity = true; npc.canGhostHeal = false; diff --git a/NPCs/Bumblefuck/Bumblefuck3.cs b/NPCs/Bumblefuck/Bumblefuck3.cs deleted file mode 100644 index 9de7f0b9b0..0000000000 --- a/NPCs/Bumblefuck/Bumblefuck3.cs +++ /dev/null @@ -1,455 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.NPCs.Bumblefuck -{ - public class Bumblefuck3 : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Bumblebirb"); - Main.npcFrameCount[npc.type] = 10; - } - - public override void SetDefaults() - { - npc.npcSlots = 1f; - npc.aiStyle = -1; - aiType = -1; - npc.damage = 190; - npc.width = 80; //324 - npc.height = 80; //216 - npc.scale = 0.85f; - npc.defense = 40; - npc.lifeMax = 60000; - npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("ExoFreeze")] = false; - } - npc.lavaImmune = true; - npc.noGravity = true; - npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit51; - npc.DeathSound = SoundID.NPCDeath46; - } - - public override void AI() - { - if (!NPC.AnyNPCs(mod.NPCType("Yharon"))) - { - npc.active = false; - npc.netUpdate = true; - return; - } - Player player = Main.player[npc.target]; - bool revenge = CalamityWorld.revenge; - Vector2 vector = npc.Center; - npc.noTileCollide = false; - npc.noGravity = true; - npc.damage = npc.defDamage; - float generalSpeedValue = 19f; - float generalSpeedValue2 = 25f; - float generalSpeedValue3 = 9f; - float generalSpeedValue4 = 17f; - float generalSpeedValue5 = 8f; - if (Vector2.Distance(player.Center, vector) > 5600f) - { - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - } - if (npc.target < 0 || player.dead || !player.active) - { - npc.TargetClosest(true); - if (player.dead) - { - npc.ai[0] = -1f; - } - } - else - { - Vector2 vector205 = player.Center - npc.Center; - if (npc.ai[0] > 1f && vector205.Length() > 3600f) - { - npc.ai[0] = 1f; - } - } - if (npc.ai[0] == -1f) - { - Vector2 value50 = new Vector2(0f, -8f); - npc.velocity = (npc.velocity * generalSpeedValue + value50) / 10f; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - return; - } - if (npc.ai[0] == 0f) - { - npc.TargetClosest(true); - if (npc.Center.X < player.Center.X - 2f) - { - npc.direction = 1; - } - if (npc.Center.X > player.Center.X + 2f) - { - npc.direction = -1; - } - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); - if (npc.velocity.X > generalSpeedValue2) - { - npc.velocity.X = generalSpeedValue2; - } - if (npc.velocity.X < -generalSpeedValue2) - { - npc.velocity.X = -generalSpeedValue2; - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); - if (npc.velocity.Y > generalSpeedValue2) - { - npc.velocity.Y = generalSpeedValue2; - } - if (npc.velocity.Y < -generalSpeedValue2) - { - npc.velocity.Y = -generalSpeedValue2; - } - } - Vector2 value51 = player.Center - npc.Center; - value51.Y -= 200f; - if (value51.Length() > 1600f) //800 - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (value51.Length() > 80f) - { - float scaleFactor15 = generalSpeedValue3; //6 - float num1306 = 30f; - value51.Normalize(); - value51 *= scaleFactor15; - npc.velocity = (npc.velocity * (num1306 - 1f) + value51) / num1306; - } - else if (npc.velocity.Length() > generalSpeedValue4) //8 - { - npc.velocity *= 0.95f; - } - else if (npc.velocity.Length() < generalSpeedValue5) //4 - { - npc.velocity *= 1.05f; - } - npc.ai[1] += 1f; - if (npc.justHit) - { - npc.ai[1] += (float)Main.rand.Next(10, 30); - } - if (npc.ai[1] >= 180f && Main.netMode != 1) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - while (npc.ai[0] == 0f) - { - int num1307 = Main.rand.Next(3); - if (num1307 == 0 && Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) - { - npc.ai[0] = 2f; - } - else if (num1307 >= 1) - { - npc.ai[0] = 3f; - } - } - return; - } - } - else - { - if (npc.ai[0] == 1f) - { - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - if (npc.target < 0 || !player.active || player.dead) - { - npc.TargetClosest(true); - } - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else if (npc.velocity.X > 0f) - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.04f) / 10f; - Vector2 value52 = player.Center - npc.Center; - if (value52.Length() < 500f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) //500 - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - float scaleFactor16 = generalSpeedValue3 + value52.Length() / 100f; //7 - float num1308 = 25f; - value52.Normalize(); - value52 *= scaleFactor16; - npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308; - return; - } - if (npc.ai[0] == 2f) - { - npc.damage = (int)((double)npc.defDamage * 0.85); - if (npc.target < 0 || !player.active || player.dead) - { - npc.TargetClosest(true); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - if (player.Center.X - 10f < npc.Center.X) - { - npc.direction = -1; - } - else if (player.Center.X + 10f > npc.Center.X) - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.05f) / 5f; - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * (-npc.oldVelocity.X * 0.5f); - if (npc.velocity.X > generalSpeedValue2) //4 - { - npc.velocity.X = generalSpeedValue2; //4 - } - if (npc.velocity.X < -generalSpeedValue2) //4 - { - npc.velocity.X = -generalSpeedValue2; //4 - } - } - if (npc.collideY) - { - npc.velocity.Y = npc.velocity.Y * (-npc.oldVelocity.Y * 0.5f); - if (npc.velocity.Y > generalSpeedValue2) //4 - { - npc.velocity.Y = generalSpeedValue2; //4 - } - if (npc.velocity.Y < -generalSpeedValue2) //4 - { - npc.velocity.Y = -generalSpeedValue2; //4 - } - } - Vector2 value53 = player.Center - npc.Center; - value53.Y -= 20f; - npc.ai[2] += 0.0222222228f; - if (Main.expertMode) - { - npc.ai[2] += 0.0166666675f; - } - float scaleFactor17 = generalSpeedValue3 + npc.ai[2] + value53.Length() / 120f; //4 - float num1309 = 20f; - value53.Normalize(); - value53 *= scaleFactor17; - npc.velocity = (npc.velocity * (num1309 - 1f) + value53) / num1309; - npc.ai[1] += 1f; - if (npc.ai[1] > 240f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - return; - } - } - else - { - if (npc.ai[0] == 3f) - { - npc.noTileCollide = true; - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; - Vector2 value54 = player.Center - npc.Center; - value54.Y -= 12f; - if (npc.Center.X > player.Center.X) - { - value54.X += 400f; - } - else - { - value54.X -= 400f; - } - if (Math.Abs(npc.Center.X - player.Center.X) > 350f && Math.Abs(npc.Center.Y - player.Center.Y) < 20f) - { - npc.ai[0] = 3.1f; - npc.ai[1] = 0f; - } - npc.ai[1] += 0.0333333351f; - float scaleFactor18 = generalSpeedValue4 + npc.ai[1]; //8 - float num1310 = 4f; - value54.Normalize(); - value54 *= scaleFactor18; - npc.velocity = (npc.velocity * (num1310 - 1f) + value54) / num1310; - return; - } - if (npc.ai[0] == 3.1f) - { - npc.noTileCollide = true; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; - Vector2 vector206 = player.Center - npc.Center; - vector206.Y -= 12f; - float scaleFactor19 = generalSpeedValue2; //16 - float num1311 = 8f; - vector206.Normalize(); - vector206 *= scaleFactor19; - npc.velocity = (npc.velocity * (num1311 - 1f) + vector206) / num1311; - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.spriteDirection = npc.direction; - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - npc.velocity = vector206; - if (npc.velocity.X < 0f) - { - npc.direction = -1; - } - else - { - npc.direction = 1; - } - npc.ai[0] = 3.2f; - npc.ai[1] = 0f; - npc.ai[1] = (float)npc.direction; - return; - } - } - else - { - if (npc.ai[0] == 3.2f) - { - npc.damage = (int)((double)npc.defDamage * 1.5); - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - npc.ai[2] += 0.0333333351f; - npc.velocity.X = (generalSpeedValue4 + npc.ai[2]) * npc.ai[1]; //16 - if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + 260f) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - 260f)) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (Math.Abs(npc.Center.X - player.Center.X) > 1200f) //800 - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; - return; - } - } - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (double)(npc.velocity.Length() / 4f); - npc.frameCounter += 1.0; - if (npc.ai[0] < 4f) - { - if (npc.frameCounter >= 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y / frameHeight > 4) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frameCounter >= 6.0) - { - npc.frameCounter = 0.0; - npc.frame.Y = npc.frame.Y + frameHeight; - } - if (npc.frame.Y / frameHeight > 9) - { - npc.frame.Y = frameHeight * 5; - } - } - } - - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); - } - } - } - } -} \ No newline at end of file diff --git a/NPCs/Bumblefuck/Bumblefuck3.png b/NPCs/Bumblefuck/Bumblefuck3.png deleted file mode 100644 index 4b1e72a257..0000000000 Binary files a/NPCs/Bumblefuck/Bumblefuck3.png and /dev/null differ diff --git a/NPCs/Calamitas/Calamitas.cs b/NPCs/Calamitas/Calamitas.cs index 0908d89393..0b32b50e0d 100644 --- a/NPCs/Calamitas/Calamitas.cs +++ b/NPCs/Calamitas/Calamitas.cs @@ -41,21 +41,21 @@ namespace CalamityMod.NPCs.Calamitas for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.boss = true; npc.noGravity = true; npc.noTileCollide = true; @@ -71,6 +71,8 @@ namespace CalamityMod.NPCs.Calamitas { npc.lifeMax = CalamityWorld.death ? 1300000 : 1100000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index 17b2bb1c6e..5f8521af89 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -13,14 +13,14 @@ namespace CalamityMod.NPCs.Calamitas [AutoloadBossHead] public class CalamitasRun : ModNPC { - public bool canDespawn = false; + public bool canDespawn = false; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Cataclysm"); Main.npcFrameCount[npc.type] = 6; } - + public override void SetDefaults() { npc.damage = 60; @@ -29,65 +29,67 @@ namespace CalamityMod.NPCs.Calamitas npc.height = 120; //216 npc.defense = 10; npc.alpha = 25; - npc.value = 0f; + npc.value = 0f; npc.lifeMax = CalamityWorld.revenge ? 4400 : 3000; - if (CalamityWorld.death) - { - npc.lifeMax = 5000; - } - npc.aiStyle = -1; //new - aiType = -1; //new + if (CalamityWorld.death) + { + npc.lifeMax = 5000; + } + npc.aiStyle = -1; //new + aiType = -1; //new npc.knockBackResist = 0f; NPCID.Sets.TrailCacheLength[npc.type] = 8; NPCID.Sets.TrailingMode[npc.type] = 1; for (int k = 0; k < npc.buffImmune.Length; k++) { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - } + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); - else - music = MusicID.Boss2; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); + else + music = MusicID.Boss2; if (CalamityWorld.downedProvidence) { npc.damage = 170; npc.defense = 80; npc.lifeMax = 35000; } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; - } - } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void AI() + public override void AI() { bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); @@ -155,8 +157,8 @@ namespace CalamityMod.NPCs.Calamitas if (!player.active || player.dead || (dayTime && !Main.eclipse)) { npc.velocity = new Vector2(0f, -10f); - canDespawn = true; - if (npc.timeLeft > 150) + canDespawn = true; + if (npc.timeLeft > 150) { npc.timeLeft = 150; } @@ -165,8 +167,8 @@ namespace CalamityMod.NPCs.Calamitas } else { - canDespawn = false; - } + canDespawn = false; + } if (npc.ai[1] == 0f) { float num861 = 5f; @@ -242,7 +244,7 @@ namespace CalamityMod.NPCs.Calamitas npc.velocity.Y = npc.velocity.Y - num862; } } - npc.ai[2] += (npc.GetGlobalNPC(mod).enraged ? 2f : 1f); + npc.ai[2] += ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); if (npc.ai[2] >= 400f) { npc.ai[1] = 1f; @@ -251,8 +253,8 @@ namespace CalamityMod.NPCs.Calamitas npc.target = 255; npc.netUpdate = true; } - bool fireDelay = npc.ai[2] > 120f || (double)npc.life < (double)npc.lifeMax * 0.9; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) + bool fireDelay = npc.ai[2] > 120f || (double)npc.life < (double)npc.lifeMax * 0.9; + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) { npc.localAI[2] += 1f; if (npc.localAI[2] > 22f) @@ -315,10 +317,10 @@ namespace CalamityMod.NPCs.Calamitas { num870 += 1f; } - if (npc.GetGlobalNPC(mod).enraged) - { - num870 += 4f; - } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num870 += 4f; + } Vector2 vector87 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num871 = player.position.X + (float)(player.width / 2) - vector87.X; float num872 = player.position.Y + (float)(player.height / 2) - vector87.Y; @@ -397,10 +399,10 @@ namespace CalamityMod.NPCs.Calamitas { goto IL_6899; } - IL_6881: + IL_6881: num161 += num158; continue; - IL_6899: + IL_6899: float num164 = (float)(num157 - num161); if (num158 < 0) { @@ -418,11 +420,11 @@ namespace CalamityMod.NPCs.Calamitas } public override bool CheckActive() - { - return canDespawn; - } + { + return canDespawn; + } - public override void NPCLoot() + public override void NPCLoot() { if (Main.rand.Next(10) == 0) { @@ -445,7 +447,7 @@ namespace CalamityMod.NPCs.Calamitas Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BrimstoneFlameblaster")); } } - + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) @@ -485,7 +487,7 @@ namespace CalamityMod.NPCs.Calamitas } } } - + public override void OnHitPlayer(Player player, int damage, bool crit) { if (CalamityWorld.revenge) diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index 0eab3f7f8c..f507a156b9 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -13,14 +13,14 @@ namespace CalamityMod.NPCs.Calamitas [AutoloadBossHead] public class CalamitasRun2 : ModNPC { - public bool canDespawn = false; + public bool canDespawn = false; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Catastrophe"); Main.npcFrameCount[npc.type] = 6; } - + public override void SetDefaults() { npc.damage = 65; @@ -29,14 +29,14 @@ namespace CalamityMod.NPCs.Calamitas npc.height = 120; //216 npc.defense = 10; npc.alpha = 25; - npc.value = 0f; - npc.lifeMax = CalamityWorld.revenge ? 3675 : 2500; - if (CalamityWorld.death) - { - npc.lifeMax = 4400; - } - npc.aiStyle = -1; //new - aiType = -1; //new + npc.value = 0f; + npc.lifeMax = CalamityWorld.revenge ? 3675 : 2500; + if (CalamityWorld.death) + { + npc.lifeMax = 4400; + } + npc.aiStyle = -1; //new + aiType = -1; //new npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; @@ -44,50 +44,52 @@ namespace CalamityMod.NPCs.Calamitas NPCID.Sets.TrailingMode[npc.type] = 1; for (int k = 0; k < npc.buffImmune.Length; k++) { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - } + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); - else - music = MusicID.Boss2; - if (CalamityWorld.downedProvidence) + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas"); + else + music = MusicID.Boss2; + if (CalamityWorld.downedProvidence) { npc.damage = 200; npc.defense = 95; npc.lifeMax = 30000; } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 800000 : 700000; - } - } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 800000 : 700000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override void AI() + public override void AI() { bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); @@ -155,8 +157,8 @@ namespace CalamityMod.NPCs.Calamitas if (!player.active || player.dead || (dayTime && !Main.eclipse)) { npc.velocity = new Vector2(0f, -10f); - canDespawn = true; - if (npc.timeLeft > 150) + canDespawn = true; + if (npc.timeLeft > 150) { npc.timeLeft = 150; } @@ -165,8 +167,8 @@ namespace CalamityMod.NPCs.Calamitas } else { - canDespawn = false; - } + canDespawn = false; + } if (npc.ai[1] == 0f) { float num861 = 4f; @@ -242,7 +244,7 @@ namespace CalamityMod.NPCs.Calamitas npc.velocity.Y = npc.velocity.Y - num862; } } - npc.ai[2] += (npc.GetGlobalNPC(mod).enraged ? 2f : 1f); + npc.ai[2] += ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); if (npc.ai[2] >= 200f) { npc.ai[1] = 1f; @@ -251,8 +253,8 @@ namespace CalamityMod.NPCs.Calamitas npc.target = 255; npc.netUpdate = true; } - bool fireDelay = npc.ai[2] > 120f || (double)npc.life < (double)npc.lifeMax * 0.9; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) + bool fireDelay = npc.ai[2] > 120f || (double)npc.life < (double)npc.lifeMax * 0.9; + if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) { npc.localAI[2] += 1f; if (npc.localAI[2] > 22f) @@ -315,10 +317,10 @@ namespace CalamityMod.NPCs.Calamitas { num870 += 1f; } - if (npc.GetGlobalNPC(mod).enraged) - { - num870 += 4f; - } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + num870 += 4f; + } Vector2 vector87 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num871 = player.position.X + (float)(player.width / 2) - vector87.X; float num872 = player.position.Y + (float)(player.height / 2) - vector87.Y; @@ -397,10 +399,10 @@ namespace CalamityMod.NPCs.Calamitas { goto IL_6899; } - IL_6881: + IL_6881: num161 += num158; continue; - IL_6899: + IL_6899: float num164 = (float)(num157 - num161); if (num158 < 0) { @@ -418,11 +420,11 @@ namespace CalamityMod.NPCs.Calamitas } public override bool CheckActive() - { - return canDespawn; - } + { + return canDespawn; + } - public override void NPCLoot() + public override void NPCLoot() { if (Main.rand.Next(10) == 0) { @@ -437,7 +439,7 @@ namespace CalamityMod.NPCs.Calamitas Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrushsawCrasher")); } } - + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) @@ -477,7 +479,7 @@ namespace CalamityMod.NPCs.Calamitas } } } - + public override void OnHitPlayer(Player player, int damage, bool crit) { if (CalamityWorld.revenge) diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index 7b285d91ec..337ad18171 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -50,21 +50,21 @@ namespace CalamityMod.NPCs.Calamitas for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.boss = true; npc.noGravity = true; npc.noTileCollide = true; @@ -87,6 +87,8 @@ namespace CalamityMod.NPCs.Calamitas { npc.lifeMax = CalamityWorld.death ? 3300000 : 3000000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); } public override void FindFrame(int frameHeight) @@ -142,53 +144,22 @@ namespace CalamityMod.NPCs.Calamitas if ((float)(npc.life + num660) < bossLife) { bossLife = (float)npc.life; - if (!expertMode) + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("RedSpawn"), 0, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("GraySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); + if (CalamityWorld.death) { - int num661 = Main.rand.Next(8, 13); - for (int num662 = 0; num662 < num661; num662++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num663 = mod.NPCType("LifeSeeker"); - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663, -1f); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - } - } - else - { - if (revenge) - { - int num661 = Main.rand.Next(5, 9); - for (int num662 = 0; num662 < num661; num662++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num663 = mod.NPCType("LifeSeeker"); - int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num664].SetDefaults(num663, -1f); - Main.npc[num664].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num664].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - } - } Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("RedSpawn"), 0, 0f, Main.myPlayer, 0f, 0f); Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("GraySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); - if (CalamityWorld.death) - { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("RedSpawn"), 0, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("GraySpawn"), 0, 0f, Main.myPlayer, 0f, 0f); - } - string key = "Mods.CalamityMod.CalamitasBossText4"; - Color messageColor = Color.Orange; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } + } + string key = "Mods.CalamityMod.CalamitasBossText4"; + Color messageColor = Color.Orange; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } return; } @@ -206,7 +177,7 @@ namespace CalamityMod.NPCs.Calamitas npc.defense += num568 * 50; if (!flag100) { - npc.defense = 30; + npc.defense = provy ? 150 : 25; } } npc.chaseable = !flag100; @@ -361,7 +332,7 @@ namespace CalamityMod.NPCs.Calamitas { npc.localAI[1] = 0f; float num828 = expertMode ? 14f : 12.5f; - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num828 += 5f; } @@ -441,7 +412,7 @@ namespace CalamityMod.NPCs.Calamitas { npc.localAI[1] += 0.5f; } - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { npc.localAI[1] += 1f; } diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index cd9d02d495..06c186af26 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -36,8 +36,9 @@ namespace CalamityMod.NPCs.Calamitas for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; } @@ -64,6 +65,13 @@ namespace CalamityMod.NPCs.Calamitas { if (Main.netMode != 1 && Main.rand.Next(10) == 0) { + if (NPC.CountNPCS(mod.NPCType("LifeSeeker")) < 10) + { + int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 25)); + int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 25)); + int num663 = mod.NPCType("LifeSeeker"); + int num664 = NPC.NewNPC(x, y, num663, 0, 0f, 0f, 0f, 0f, 255); + } for (int num621 = 0; num621 < 5; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 235, 0f, 0f, 100, default(Color), 2f); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 9b293d8e8e..d8deecfd4b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -17,6 +17,8 @@ using Terraria.GameContent.Generation; using CalamityMod.Tiles; using CalamityMod.Projectiles; using CalamityMod; +using CalamityMod.Items; +using CalamityMod.World; namespace CalamityMod.NPCs { @@ -49,6 +51,10 @@ namespace CalamityMod.NPCs private int CultCountdown = 0; + public bool wCleave = false; + + public bool bBlood = false; + public bool dFlames = false; public bool marked = false; @@ -129,6 +135,8 @@ namespace CalamityMod.NPCs #region ResetEffects public override void ResetEffects(NPC npc) { + wCleave = false; + bBlood = false; dFlames = false; marked = false; irradiated = false; @@ -251,10 +259,10 @@ namespace CalamityMod.NPCs amount++; } } - npc.lifeRegen -= amount * 500; - if (damage < amount * 50) + npc.lifeRegen -= amount * 350; + if (damage < amount * 35) { - damage = amount * 50; + damage = amount * 35; } } if (clamDebuff) @@ -438,6 +446,18 @@ namespace CalamityMod.NPCs damage = 500; } } + if (bBlood) + { + if (npc.lifeRegen > 0) + { + npc.lifeRegen = 0; + } + npc.lifeRegen -= 50; + if (damage < 10) + { + damage = 10; + } + } } #endregion @@ -448,6 +468,7 @@ namespace CalamityMod.NPCs { newAI[m] = 0f; } + if (npc.boss && CalamityWorld.revenge) { if (npc.type != mod.NPCType("HiveMindP2") && npc.type != mod.NPCType("Leviathan") && npc.type != mod.NPCType("StormWeaverHeadNaked") && @@ -464,6 +485,7 @@ namespace CalamityMod.NPCs } } } + if (CalamityWorld.bossRushActive) { if (!npc.friendly) @@ -471,10 +493,13 @@ namespace CalamityMod.NPCs for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; + } + if (npc.type != mod.NPCType("DevourerofGodsHeadS") && npc.type != mod.NPCType("DevourerofGodsBodyS") && npc.type != mod.NPCType("DevourerofGodsTailS")) + { npc.buffImmune[BuffID.Ichor] = false; npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("Enraged")] = false; } + npc.buffImmune[mod.BuffType("Enraged")] = false; } } else @@ -498,6 +523,8 @@ namespace CalamityMod.NPCs { npc.buffImmune[BuffID.Wet] = false; npc.buffImmune[BuffID.Slimed] = false; + npc.buffImmune[BuffID.Lovestruck] = false; + npc.buffImmune[BuffID.Stinky] = false; } } if (npc.buffImmune[mod.BuffType("Enraged")]) @@ -505,6 +532,7 @@ namespace CalamityMod.NPCs npc.buffImmune[mod.BuffType("Enraged")] = false; } } + if (npc.type == NPCID.QueenBee) { npc.value = Item.buyPrice(0, 5, 0, 0); @@ -529,6 +557,7 @@ namespace CalamityMod.NPCs { npc.value = (float)((int)((double)npc.value * 1.5)); } + if (CalamityWorld.bossRushActive) { switch (npc.type) @@ -670,6 +699,7 @@ namespace CalamityMod.NPCs break; } } + if (npc.type == NPCID.CultistBoss) { if (CalamityWorld.death) @@ -682,6 +712,12 @@ namespace CalamityMod.NPCs } npc.npcSlots = 20f; } + + if (npc.type >= NPCID.TombCrawlerHead && npc.type <= NPCID.TombCrawlerTail && !Main.hardMode) + { + npc.lifeMax = (int)((double)npc.lifeMax * 0.6); + } + if (DraedonMayhem) { if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail) @@ -702,12 +738,12 @@ namespace CalamityMod.NPCs { if (CalamityWorld.death) { - npc.lifeMax = (int)((double)npc.lifeMax * 2.7); + npc.lifeMax = (int)((double)npc.lifeMax * 1.9); npc.scale *= 1.25f; } else { - npc.lifeMax = (int)((double)npc.lifeMax * 1.8); + npc.lifeMax = (int)((double)npc.lifeMax * 1.6); npc.scale *= 1.2f; } } @@ -758,6 +794,7 @@ namespace CalamityMod.NPCs npc.npcSlots = 10f; } } + if (CalamityWorld.revenge) { npc.value = (float)((int)((double)npc.value * 1.5)); @@ -971,6 +1008,11 @@ namespace CalamityMod.NPCs npc.lifeMax = (int)((double)npc.lifeMax * 1.85); //85% boost } } + else if (npc.type == NPCID.Wraith || npc.type == NPCID.Mimic || npc.type == NPCID.Reaper || npc.type == NPCID.PresentMimic || npc.type == NPCID.SandElemental) + { + npc.knockBackResist = 0f; + } + if (!DraedonMayhem) { if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail) @@ -1041,6 +1083,7 @@ namespace CalamityMod.NPCs npc.npcSlots = 10f; } } + if (npc.type == NPCID.Probe || npc.type == NPCID.MoonLordFreeEye || (npc.type >= 454 && npc.type <= 459) || npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2 || npc.type == NPCID.PlanterasTentacle || npc.type == NPCID.Spore || npc.type == NPCID.TheHungryII || npc.type == NPCID.LeechHead || @@ -1051,18 +1094,19 @@ namespace CalamityMod.NPCs { npc.canGhostHeal = false; } + if (npc.type == mod.NPCType("Cnidrion") || npc.type == mod.NPCType("DesertScourgeBody") || npc.type == mod.NPCType("ColossalSquid") || npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("ThiccWaifu") || npc.type == mod.NPCType("ProfanedGuardianBoss3") || npc.type == mod.NPCType("ScornEater") || npc.type == mod.NPCType("AquaticScourgeBody") || npc.type == mod.NPCType("AquaticScourgeBodyAlt") || - npc.type == mod.NPCType("Mauler")) + npc.type == mod.NPCType("Mauler") || npc.type == mod.NPCType("EutrophicRay")) { protection = 0.05f; } else if (npc.type == mod.NPCType("AstrumDeusBody") || npc.type == mod.NPCType("SoulSeeker") || npc.type == mod.NPCType("DesertScourgeTail") || npc.type == mod.NPCType("Horse") || npc.type == mod.NPCType("ProfanedEnergyBody") || npc.type == mod.NPCType("ScavengerClawLeft") || npc.type == mod.NPCType("ScavengerClawRight") || npc.type == mod.NPCType("ScavengerHead") || npc.type == mod.NPCType("MantisShrimp") || - npc.type == mod.NPCType("PhantomDebris") || npc.type == mod.NPCType("Astrageldon") || npc.type == mod.NPCType("AstrumDeusHead") || - npc.type == mod.NPCType("AquaticScourgeHead") || npc.type == mod.NPCType("Cryon") || npc.type == mod.NPCType("Cryogen")) + npc.type == mod.NPCType("PhantomDebris") || npc.type == mod.NPCType("AstrumDeusHead") || npc.type == mod.NPCType("AquaticScourgeHead") || + npc.type == mod.NPCType("Cryon") || npc.type == mod.NPCType("Cryogen")) { protection = 0.1f; } @@ -1071,21 +1115,25 @@ namespace CalamityMod.NPCs npc.type == mod.NPCType("SoulSlurper") || npc.type == mod.NPCType("ProvSpawnHealer") || npc.type == mod.NPCType("Gnasher") || npc.type == mod.NPCType("ScavengerLegLeft") || npc.type == mod.NPCType("ScavengerLegRight") || npc.type == mod.NPCType("ShockstormShuttle") || npc.type == mod.NPCType("Reaper") || npc.type == mod.NPCType("OverloadedSoldier") || npc.type == mod.NPCType("AquaticScourgeTail") || - npc.type == mod.NPCType("EidolonWyrmHead")) + npc.type == mod.NPCType("EidolonWyrmHead") || npc.type == mod.NPCType("Aries") || npc.type == mod.NPCType("AstralachneaGround") || + npc.type == mod.NPCType("AstralachneaWall") || npc.type == mod.NPCType("Astrageldon") || npc.type == mod.NPCType("Atlas") || + npc.type == mod.NPCType("BigSightseer") || npc.type == mod.NPCType("FusionFeeder") || npc.type == mod.NPCType("Hadarian") || + npc.type == mod.NPCType("Hive") || npc.type == mod.NPCType("Mantis") || npc.type == mod.NPCType("Nova") || npc.type == mod.NPCType("SmallSightseer") || + npc.type == mod.NPCType("StellarCulex")) { protection = 0.15f; } - else if (npc.type == mod.NPCType("AstrumDeusProbe3") || npc.type == mod.NPCType("PlaguebringerShade")) + else if (npc.type == mod.NPCType("AstrumDeusProbe3") || npc.type == mod.NPCType("PlaguebringerShade") || npc.type == mod.NPCType("BlindedAngler")) { protection = 0.2f; } - else if (npc.type == mod.NPCType("PlaguebringerGoliath") || npc.type == mod.NPCType("ProfanedGuardianBoss2") || - npc.type == mod.NPCType("SandTortoise") || npc.type == mod.NPCType("StasisProbe") || - npc.type == mod.NPCType("BobbitWormHead") || npc.type == mod.NPCType("GreatSandShark")) + else if (npc.type == mod.NPCType("PlaguebringerGoliath") || npc.type == mod.NPCType("ProfanedGuardianBoss2") || npc.type == mod.NPCType("SandTortoise") || + npc.type == mod.NPCType("StasisProbe") || npc.type == mod.NPCType("BobbitWormHead") || npc.type == mod.NPCType("GreatSandShark") || + npc.type == mod.NPCType("Clam") || npc.type == mod.NPCType("PrismTurtle")) { protection = 0.25f; } - else if (npc.type == mod.NPCType("ProvSpawnOffense")) + else if (npc.type == mod.NPCType("ProvSpawnOffense") || npc.type == mod.NPCType("GiantClam")) { protection = 0.3f; } @@ -1125,7 +1173,8 @@ namespace CalamityMod.NPCs case NPCID.Mothron: case NPCID.Crab: case NPCID.SeaSnail: - protection = 0.05f; break; + protection = 0.05f; + break; case NPCID.Antlion: case NPCID.TheHungry: case NPCID.TheDestroyer: @@ -1145,14 +1194,16 @@ namespace CalamityMod.NPCs case NPCID.ArmoredViking: case NPCID.DD2Betsy: case NPCID.DD2OgreT2: - protection = 0.1f; break; + protection = 0.1f; + break; case NPCID.ElfCopter: case NPCID.GraniteGolem: case NPCID.ArmoredSkeleton: case NPCID.PirateShipCannon: case NPCID.DD2OgreT3: case NPCID.Golem: - protection = 0.15f; break; + protection = 0.15f; + break; case NPCID.Retinazer: case NPCID.Spazmatism: case NPCID.PrimeCannon: @@ -1195,35 +1246,43 @@ namespace CalamityMod.NPCs case 495: case 496: case 497: - protection = 0.2f; break; + protection = 0.2f; + break; case NPCID.PrimeSaw: case NPCID.PrimeVice: case NPCID.SkeletronPrime: case NPCID.Probe: case NPCID.PossessedArmor: - protection = 0.25f; break; + protection = 0.25f; + break; case NPCID.Mimic: case NPCID.PresentMimic: case 473: case 474: case 475: case 476: - protection = 0.3f; break; + protection = 0.3f; + break; case NPCID.GiantTortoise: case NPCID.IceTortoise: case NPCID.SantaNK1: case NPCID.MartianWalker: case NPCID.TheDestroyerTail: - protection = 0.35f; break; + protection = 0.35f; + break; case NPCID.DeadlySphere: - protection = 0.4f; break; + protection = 0.4f; + break; case NPCID.Paladin: - protection = 0.45f; break; + protection = 0.45f; + break; case NPCID.WallofFlesh: case NPCID.MothronEgg: - protection = 0.5f; break; + protection = 0.5f; + break; case NPCID.DungeonGuardian: - protection = 0.999999f; break; + protection = 0.999999f; + break; } } } @@ -1236,17 +1295,11 @@ namespace CalamityMod.NPCs { defProtection = protection; } - if (Main.raining && CalamityWorld.sulphurTiles > 30 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && npc.lifeMax <= 2000) - { - npc.lifeMax = (int)((double)npc.lifeMax * 1.15); - npc.damage = (int)((double)npc.damage * 1.25); - npc.life = npc.lifeMax; - npc.defDamage = npc.damage; - } + if (Main.bloodMoon && NPC.downedMoonlord && !npc.boss && !npc.friendly && !npc.dontTakeDamage && npc.lifeMax <= 2000) { npc.lifeMax = (int)((double)npc.lifeMax * 3.5); - npc.damage = (int)((double)npc.damage * 2.0); + npc.damage += 100; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } @@ -1255,14 +1308,14 @@ namespace CalamityMod.NPCs if (CalamityMod.pumpkinMoonBuffList.Contains(npc.type)) { npc.lifeMax = (int)((double)npc.lifeMax * 7.5); - npc.damage = (int)((double)npc.damage * 2.5); + npc.damage += 200; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } else if (CalamityMod.frostMoonBuffList.Contains(npc.type)) { npc.lifeMax = (int)((double)npc.lifeMax * 6.0); - npc.damage = (int)((double)npc.damage * 2.5); + npc.damage += 200; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } @@ -1270,7 +1323,7 @@ namespace CalamityMod.NPCs if (CalamityMod.eclipseBuffList.Contains(npc.type) && CalamityWorld.buffedEclipse) { npc.lifeMax = (int)((double)npc.lifeMax * 32.5); - npc.damage = (int)((double)npc.damage * 3.5); + npc.damage += 250; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } @@ -1279,11 +1332,29 @@ namespace CalamityMod.NPCs if (CalamityMod.dungeonEnemyBuffList.Contains(npc.type)) { npc.lifeMax = (int)((double)npc.lifeMax * 2.5); - npc.damage = (int)((double)npc.damage * 2.5); + npc.damage += 150; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } } + if (CalamityWorld.revenge) + { + if (CalamityMod.revengeanceEnemyBuffList.Contains(npc.type)) + { + npc.damage = (int)((double)npc.damage * 1.25); + npc.defDamage = npc.damage; + } + } + if ((npc.boss && npc.type != NPCID.MartianSaucerCore && npc.type < NPCID.Count) || + npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail || + npc.type == NPCID.SkeletronHand || npc.type == NPCID.WallofFleshEye || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail || + npc.type == NPCID.PrimeCannon || npc.type == NPCID.PrimeLaser || npc.type == NPCID.PrimeVice || npc.type == NPCID.PrimeSaw || + npc.type == NPCID.GolemHead || npc.type == NPCID.GolemFistRight || npc.type == NPCID.GolemFistLeft || npc.type == NPCID.MoonLordHead || + npc.type == NPCID.MoonLordHand) + { + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } } #endregion @@ -1294,13 +1365,6 @@ namespace CalamityMod.NPCs { if (numPlayers > 1) { - /*About 1.35 multiplier for 2 players, 1.92 for 3 players, 2.63 for 4 players, 3.44 for 5 players, 4.31 for 6 players - Destroyer has 120K HP - 2 players = 146K HP - 3 players = 173K HP - 4 players = 197K HP - 5 players = 223K HP - 6 players = 248K HP*/ if (((npc.boss || CalamityMod.bossScaleList.Contains(npc.type)) && npc.type < NPCID.Count) || (npc.modNPC != null && npc.modNPC.mod.Name.Equals("CalamityMod"))) { @@ -1308,22 +1372,22 @@ namespace CalamityMod.NPCs switch (numPlayers) //Decrease HP in multiplayer before vanilla scaling { case 2: - scalar = 0.9; + scalar = 0.76; break; case 3: - scalar = 0.75; + scalar = 0.63; break; case 4: - scalar = 0.625; + scalar = 0.525; break; case 5: - scalar = 0.54; + scalar = 0.43; break; case 6: - scalar = 0.48; + scalar = 0.36; break; default: - scalar = 0.45; + scalar = 0.295; break; } npc.lifeMax = (int)((double)npc.lifeMax * scalar); @@ -1394,81 +1458,59 @@ namespace CalamityMod.NPCs if (newAI[1] < 480f || newAI[2] > 0f) damage *= 0.01; } - if (enraged) - { - damage *= 2.25; - } + double yellowCandleDamageBoost = damage * 0.05; //get value before DR + + int newDefense = npc.defense - + (pFlames ? 4 : 0) - + (wDeath ? 50 : 0) - + (gsInferno ? 20 : 0) - + (aFlames ? 10 : 0) - + (wCleave ? 15 : 0); + + if (gState) + newDefense /= 2; + if (aCrunch) + newDefense /= 3; + if (newDefense < 0) + newDefense = 0; + + defense = newDefense; + if (protection > 0f) { - int trueDefense = defense; - if (pFlames) - { - trueDefense -= 4; - } - if (wDeath) - { - trueDefense -= 50; - } - if (gsInferno) - { - trueDefense -= 20; - } - if (aFlames) - { - trueDefense -= 10; - } - if (gState) - { - trueDefense /= 2; - } - if (aCrunch) - { - trueDefense /= 3; - } - if (trueDefense < 0) - { - trueDefense = 0; - } - double newDamage = damage + ((double)trueDefense * 0.25); //defense damage boost 150 * .25 = 45 + 150 = 195 damage 180 defense + double newDamage = damage + ((double)defense * 0.25); //defense damage boost 150 * .25 = 45 + 150 = 195 damage 180 defense + if (marked) - { protection *= 0.5f; - } - if (npc.ichor) - { - protection *= 0.75f; - } - else if (npc.onFire2) - { - protection *= 0.8f; - } if (npc.betsysCurse) - { protection *= 0.66f; - } + if (wCleave) + protection *= 0.75f; + if (npc.ichor) + protection *= 0.75f; + else if (npc.onFire2) + protection *= 0.8f; if (protection < 0f) - { protection = 0f; - } + if (newDamage >= 1.0) { newDamage = (double)(1f - protection) * newDamage; //DR calc 195 * 0.4 = 78 damage 0.6 DR if (newDamage < 1.0) - { newDamage = 1.0; - } } + damage = newDamage; protection = defProtection; } + if (protection < 0.99f) { if (yellowCandle) - { damage += yellowCandleDamageBoost; - } } + return true; //vanilla defense calc 78 - (180 / 2 = 90) = 0, boosted to 1 by calc } #endregion @@ -1482,11 +1524,14 @@ namespace CalamityMod.NPCs switch (npc.type) { case NPCID.Guide: - switch (Main.rand.Next(35)) //34 guide names + switch (Main.rand.Next(36)) //34 guide names { case 0: npc.GivenName = "Lapp"; break; + case 1: + npc.GivenName = "Ben Shapiro"; + break; default: break; } @@ -1559,6 +1604,131 @@ namespace CalamityMod.NPCs newAI[1] += 1f; } } + if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.Hornet || npc.type == NPCID.HornetFatty || npc.type == NPCID.HornetHoney || + npc.type == NPCID.HornetLeafy || npc.type == NPCID.HornetSpikey || npc.type == NPCID.HornetStingy || npc.type == NPCID.BigHornetStingy || npc.type == NPCID.LittleHornetStingy || + npc.type == NPCID.BigHornetSpikey || npc.type == NPCID.LittleHornetSpikey || npc.type == NPCID.BigHornetLeafy || npc.type == NPCID.LittleHornetLeafy || + npc.type == NPCID.BigHornetHoney || npc.type == NPCID.LittleHornetHoney || npc.type == NPCID.BigHornetFatty || npc.type == NPCID.LittleHornetFatty) + { + if (Main.player[npc.target].GetModPlayer(mod).queenBeeLore) + { + npc.damage = 0; + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + float num = 5f; + float num2 = 0.1f; + npc.localAI[0] += 1f; + float num3 = (npc.localAI[0] - 60f) / 60f; + if (num3 > 1f) + { + num3 = 1f; + } + else + { + if (npc.velocity.X > 6f) + { + npc.velocity.X = 6f; + } + if (npc.velocity.X < -6f) + { + npc.velocity.X = -6f; + } + if (npc.velocity.Y > 6f) + { + npc.velocity.Y = 6f; + } + if (npc.velocity.Y < -6f) + { + npc.velocity.Y = -6f; + } + } + num2 *= num3; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num4 = (float)npc.direction * num / 2f; + float num5 = -num / 2f; + if (npc.velocity.X < num4) + { + npc.velocity.X = npc.velocity.X + num2; + if (npc.velocity.X < 0f && num4 > 0f) + { + npc.velocity.X = npc.velocity.X + num2; + } + } + else if (npc.velocity.X > num4) + { + npc.velocity.X = npc.velocity.X - num2; + if (npc.velocity.X > 0f && num4 < 0f) + { + npc.velocity.X = npc.velocity.X - num2; + } + } + if (npc.velocity.Y < num5) + { + npc.velocity.Y = npc.velocity.Y + num2; + if (npc.velocity.Y < 0f && num5 > 0f) + { + npc.velocity.Y = npc.velocity.Y + num2; + } + } + else if (npc.velocity.Y > num5) + { + npc.velocity.Y = npc.velocity.Y - num2; + if (npc.velocity.Y > 0f && num5 < 0f) + { + npc.velocity.Y = npc.velocity.Y - num2; + } + } + if (npc.type != NPCID.Bee && npc.type != NPCID.BeeSmall) + { + if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + npc.rotation = npc.velocity.X * 0.1f; + } + else + { + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) - 1.57f; + } + float num11 = 0.7f; + if (npc.collideX) + { + npc.netUpdate = true; + npc.velocity.X = npc.oldVelocity.X * -num11; + if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) + { + npc.velocity.X = 2f; + } + if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) + { + npc.velocity.X = -2f; + } + } + if (npc.collideY) + { + npc.netUpdate = true; + npc.velocity.Y = npc.oldVelocity.Y * -num11; + if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) + { + npc.velocity.Y = 2f; + } + if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) + { + npc.velocity.Y = -2f; + } + } + if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) + { + npc.netUpdate = true; + } + return false; + } + } #region BossRush if (CalamityWorld.bossRushActive && !npc.friendly && !npc.townNPC) { @@ -1950,7 +2120,7 @@ namespace CalamityMod.NPCs int num237 = 7; int num238 = 0; bool flag10 = false; - if (vector30.Length() > (enraged ? 1000f : 2000f)) + if (vector30.Length() > ((enraged || Config.BossRushXerocCurse) ? 1000f : 2000f)) { flag10 = true; num238 = 100; @@ -2032,7 +2202,7 @@ namespace CalamityMod.NPCs float[] var_9_AF25_cp_0 = npc.ai; int var_9_AF25_cp_1 = 0; float num244 = var_9_AF25_cp_0[var_9_AF25_cp_1]; - var_9_AF25_cp_0[var_9_AF25_cp_1] = num244 + (enraged ? 2f : 1f); + var_9_AF25_cp_0[var_9_AF25_cp_1] = num244 + ((enraged || Config.BossRushXerocCurse) ? 2f : 1f); num234 = MathHelper.Clamp((60f - npc.ai[0]) / 60f, 0f, 1f); num234 = 0.5f + num234 * 0.5f; if (npc.ai[0] >= 60f) @@ -2075,7 +2245,7 @@ namespace CalamityMod.NPCs float[] var_9_B163_cp_0 = npc.ai; int var_9_B163_cp_1 = 0; float num244 = var_9_B163_cp_0[var_9_B163_cp_1]; - var_9_B163_cp_0[var_9_B163_cp_1] = num244 + (enraged ? 2f : 1f); + var_9_B163_cp_0[var_9_B163_cp_1] = num244 + ((enraged || Config.BossRushXerocCurse) ? 2f : 1f); num234 = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f); num234 = 0.5f + num234 * 0.5f; if (npc.ai[0] >= 30f && Main.netMode != 1) @@ -2111,7 +2281,7 @@ namespace CalamityMod.NPCs } if (!flag8) { - npc.ai[0] += enraged ? 4f : 2f; + npc.ai[0] += (enraged || Config.BossRushXerocCurse) ? 4f : 2f; if ((double)npc.life < (double)npc.lifeMax * 0.8) { npc.ai[0] += 1f; @@ -2286,7 +2456,7 @@ 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 = (enraged ? 21f : 14f); + float num798 = ((enraged || Config.BossRushXerocCurse) ? 21f : 14f); num797 = num798 / num797; num795 *= num797; num796 *= num797; @@ -2403,7 +2573,7 @@ namespace CalamityMod.NPCs float num803 = Main.player[npc.target].Center.X - vector99.X; float num804 = Main.player[npc.target].Center.Y - vector99.Y; float num805 = (float)Math.Sqrt((double)(num803 * num803 + num804 * num804)); - float num806 = (enraged ? 3f : 2f); + float num806 = ((enraged || Config.BossRushXerocCurse) ? 3f : 2f); if (num805 < num806) { npc.velocity.X = num803; @@ -2525,7 +2695,7 @@ namespace CalamityMod.NPCs npc.reflectingProjectiles = true; if (!Main.player[npc.target].dead) { - newAI[0] += (enraged ? 6f : 3f); + newAI[0] += ((enraged || Config.BossRushXerocCurse) ? 6f : 3f); } if (newAI[0] >= 180f) { @@ -2540,7 +2710,7 @@ namespace CalamityMod.NPCs num350 *= num351; if (Main.netMode != 1) { - float num418 = (enraged ? 18f : 12f); + float num418 = ((enraged || Config.BossRushXerocCurse) ? 18f : 12f); int num419 = 12; int num420 = 96; num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); @@ -2706,7 +2876,7 @@ namespace CalamityMod.NPCs npc.direction = 1; } npc.spriteDirection = npc.direction; - int num604 = (enraged ? 150 : 250); + int num604 = ((enraged || Config.BossRushXerocCurse) ? 150 : 250); int num605 = 1; if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2)) { @@ -2908,7 +3078,7 @@ namespace CalamityMod.NPCs Main.PlaySound(SoundID.Item17, npc.position); if (Main.netMode != 1) { - float num624 = (enraged ? 24f : 16f); + float num624 = ((enraged || Config.BossRushXerocCurse) ? 24f : 16f); float num625 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector78.X + (float)Main.rand.Next(-80, 81); float num626 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector78.Y + (float)Main.rand.Next(-40, 41); float num627 = (float)Math.Sqrt((double)(num625 * num625 + num626 * num626)); @@ -3060,15 +3230,15 @@ namespace CalamityMod.NPCs float scaleFactor = 9.5f; if (flag4) { - num3 = (enraged ? 0.9f : 0.8f); - scaleFactor = (enraged ? 15f : 13f); - num2 = (enraged ? 22 : 25); + num3 = ((enraged || Config.BossRushXerocCurse) ? 0.9f : 0.8f); + scaleFactor = ((enraged || Config.BossRushXerocCurse) ? 15f : 13f); + num2 = ((enraged || Config.BossRushXerocCurse) ? 22 : 25); } else if (flag3 & flag5) { - num3 = (enraged ? 0.8f : 0.7f); - scaleFactor = (enraged ? 13f : 11f); - num2 = (enraged ? 30 : 35); + num3 = ((enraged || Config.BossRushXerocCurse) ? 0.8f : 0.7f); + scaleFactor = ((enraged || Config.BossRushXerocCurse) ? 13f : 11f); + num2 = ((enraged || Config.BossRushXerocCurse) ? 30 : 35); } else if (flag5 && !flag3 && !flag4) { @@ -3078,13 +3248,13 @@ namespace CalamityMod.NPCs float num5 = 18f; if (flag4) { - num4 = (enraged ? 18 : 20); - num5 = (enraged ? 30f : 28f); + num4 = ((enraged || Config.BossRushXerocCurse) ? 18 : 20); + num5 = ((enraged || Config.BossRushXerocCurse) ? 30f : 28f); } else if (flag5 & flag3) { - num4 = (enraged ? 21 : 23); - num5 = (enraged ? 25f : 22f); + num4 = ((enraged || Config.BossRushXerocCurse) ? 21 : 23); + num5 = ((enraged || Config.BossRushXerocCurse) ? 25f : 22f); } int num6 = 80; int num7 = 4; @@ -4017,6 +4187,7 @@ namespace CalamityMod.NPCs #endregion if (CalamityWorld.revenge || CalamityWorld.bossRushActive) { + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; #region Mothron if (npc.type == NPCID.Mothron && CalamityWorld.buffedEclipse) { @@ -5245,8 +5416,8 @@ namespace CalamityMod.NPCs { if (npc.ai[1] == 0f) { - float num11 = (enraged ? 10f : 7f); - float num12 = (enraged ? 0.2f : 0.15f); + float num11 = ((enraged || configBossRushBoost) ? 10f : 7f); + float num12 = ((enraged || configBossRushBoost) ? 0.2f : 0.15f); Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num13 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector.X; float num14 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 200f - vector.Y; @@ -5342,7 +5513,7 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == 1f) { npc.rotation = num8; - float num24 = (enraged ? 11f : 7.25f); + float num24 = ((enraged || configBossRushBoost) ? 11f : 7.25f); Vector2 vector4 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num25 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector4.X; float num26 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector4.Y; @@ -5516,8 +5687,8 @@ namespace CalamityMod.NPCs } if (npc.ai[1] == 0f) { - float num37 = (enraged ? 8f : 5.5f); - float num38 = (enraged ? 0.09f : 0.06f); + float num37 = ((enraged || configBossRushBoost) ? 8f : 5.5f); + float num38 = ((enraged || configBossRushBoost) ? 0.09f : 0.06f); Vector2 vector8 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num39 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector8.X; float num40 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 120f - vector8.Y; @@ -5590,7 +5761,7 @@ namespace CalamityMod.NPCs { Main.PlaySound(36, (int)npc.position.X, (int)npc.position.Y, 0, 1f, 0f); npc.rotation = num8; - float num42 = (enraged ? 9.5f : 6.2f); + float num42 = ((enraged || configBossRushBoost) ? 9.5f : 6.2f); if (npc.ai[3] == 1f) { num42 *= 1.15f; @@ -5678,7 +5849,7 @@ namespace CalamityMod.NPCs else if (Main.netMode != 1) { npc.TargetClosest(true); - float num48 = (enraged ? 26f : 18f); + float num48 = ((enraged || configBossRushBoost) ? 26f : 18f); Vector2 vector10 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num49 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector10.X; float num50 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector10.Y; @@ -5801,8 +5972,8 @@ namespace CalamityMod.NPCs else if (npc.ai[1] == 5f) { float num62 = 600f; - float num63 = (enraged ? 12f : 8f); - float num64 = (enraged ? 0.4f : 0.25f); + float num63 = ((enraged || configBossRushBoost) ? 12f : 8f); + float num64 = ((enraged || configBossRushBoost) ? 0.4f : 0.25f); Vector2 vector11 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num65 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector11.X; float num66 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) + num62 - vector11.Y; @@ -5882,6 +6053,7 @@ namespace CalamityMod.NPCs #region RevengeanceAIChanges if (CalamityWorld.revenge || CalamityWorld.bossRushActive) { + bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive; #region MoonLord if (npc.type == NPCID.MoonLordFreeEye) { @@ -5896,6 +6068,43 @@ namespace CalamityMod.NPCs } if (npc.type == NPCID.MoonLordCore) { + if (npc.ai[0] >= 0f && npc.ai[0] < 2f && Main.netMode != 1 && npc.Distance(Main.player[npc.target].Center) > 1800f) //2400 + { + npc.ai[0] = -2f; + npc.netUpdate = true; + Vector2 value8 = Main.player[npc.target].Center - Vector2.UnitY * 150f - npc.Center; + npc.position += value8; + if (Main.npc[(int)npc.localAI[0]].active) + { + NPC nPC6 = Main.npc[(int)npc.localAI[0]]; + nPC6.position += value8; + Main.npc[(int)npc.localAI[0]].netUpdate = true; + } + if (Main.npc[(int)npc.localAI[1]].active) + { + NPC nPC6 = Main.npc[(int)npc.localAI[1]]; + nPC6.position += value8; + Main.npc[(int)npc.localAI[1]].netUpdate = true; + } + if (Main.npc[(int)npc.localAI[2]].active) + { + NPC nPC6 = Main.npc[(int)npc.localAI[2]]; + nPC6.position += value8; + Main.npc[(int)npc.localAI[2]].netUpdate = true; + } + int num; + for (int num1176 = 0; num1176 < 200; num1176 = num + 1) + { + NPC nPC7 = Main.npc[num1176]; + if (nPC7.active && nPC7.type == NPCID.MoonLordFreeEye) + { + NPC nPC6 = nPC7; + nPC6.position += value8; + nPC7.netUpdate = true; + } + num = num1176; + } + } if (NPC.CountNPCS(NPCID.MoonLordFreeEye) > 3) { npc.dontTakeDamage = true; @@ -5903,32 +6112,8 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) { - bool flag90 = npc.ai[2] == 0f; - float num1133 = (float)(-(float)flag90.ToDirectionInt()); if (npc.ai[0] == -2f) { - if (npc.type == NPCID.MoonLordHead) - { - if (NPC.CountNPCS(mod.NPCType("Eidolist")) < 1) - { - if (NPC.CountNPCS(NPCID.MoonLordFreeEye) <= 3 || enraged) - { - if (newAI[1] < 600f) - { - newAI[1] += 1f; - } - if (newAI[1] >= 600f) - { - newAI[1] = 0f; - npc.netUpdate = true; - if (Main.netMode != 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Eidolist"), 0, 0f, 0f, 0f, 0f, 255); - } - } - } - } - } if ((double)Main.npc[(int)npc.ai[3]].life <= (double)Main.npc[(int)npc.ai[3]].lifeMax * 0.75) { if (newAI[2] < 90f) @@ -5966,84 +6151,6 @@ namespace CalamityMod.NPCs } } } - if (npc.type == NPCID.MoonLordHead) - { - if (Main.netMode != 1) - { - newAI[0] += 1f; - if (newAI[0] >= (enraged ? 300f : 480f)) - { - newAI[0] = 0f; - npc.TargetClosest(true); - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 103, 1f, 0f); - for (int num194 = 0; num194 < 40; num194++) - { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 229, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 229, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int laserDamage = 30; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - float ai = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * num1133; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 9f), (float)(Math.Cos(offsetAngle) * 9f), 452, laserDamage, 0f, Main.myPlayer, 0f, ai); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 9f), (float)(-Math.Cos(offsetAngle) * 9f), 462, laserDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - else - { - if (Main.netMode != 1) - { - newAI[0] += 1f; - if (newAI[0] >= (enraged ? 300f : 480f)) - { - newAI[0] = 0f; - npc.TargetClosest(true); - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, 103, 1f, 0f); - for (int num194 = 0; num194 < 40; num194++) - { - int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 229, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 229, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int laserDamage = 30; - for (i = 0; i < 4; i++) - { - offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; - float ai = (6.28318548f * (float)Main.rand.NextDouble() - 3.14159274f) / 30f + 0.0174532924f * num1133; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 9f), (float)(Math.Cos(offsetAngle) * 9f), 452, laserDamage, 0f, Main.myPlayer, 0f, ai); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 9f), (float)(-Math.Cos(offsetAngle) * 9f), 462, laserDamage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } } } #endregion @@ -6054,10 +6161,9 @@ namespace CalamityMod.NPCs { npc.buffImmune[mod.BuffType("Enraged")] = false; } - bool goNuts = (double)npc.life <= (double)npc.lifeMax * 0.5 || enraged; - if (goNuts) + if ((double)npc.life <= (double)npc.lifeMax * 0.5 || enraged || configBossRushBoost) { - if (NPC.CountNPCS(mod.NPCType("Eidolist")) < 2) + if (!NPC.AnyNPCs(mod.NPCType("Eidolist"))) { if (newAI[0] < 120f) { @@ -6071,14 +6177,11 @@ namespace CalamityMod.NPCs { NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("Eidolist"), 0, 0f, 0f, 0f, 0f, 255); } - if (NPC.CountNPCS(mod.NPCType("Eidolist")) > 1) - { - newAI[0] = -780f; - } + newAI[0] = -360f; } } } - if (!goNuts) + else { if (CultCountdown == 0) { @@ -6349,7 +6452,7 @@ namespace CalamityMod.NPCs } if (Main.netMode != 1) { - npc.localAI[1] += (enraged ? 3f : 1.5f); + npc.localAI[1] += ((enraged || configBossRushBoost) ? 3f : 1.5f); } } else @@ -6365,7 +6468,7 @@ namespace CalamityMod.NPCs { newAI[0] += 0.5f; } - if (newAI[0] >= (enraged ? 150f : 270f)) + if (newAI[0] >= ((enraged || configBossRushBoost) ? 150f : 270f)) { newAI[0] = 0f; if (Main.netMode != 1 && NPC.CountNPCS(NPCID.PlanterasTentacle) < 20) @@ -6384,7 +6487,7 @@ namespace CalamityMod.NPCs { newAI[1] += 2f; } - if (newAI[1] >= (enraged ? 180f : 240f)) + if (newAI[1] >= ((enraged || configBossRushBoost) ? 180f : 240f)) { newAI[1] = 0f; if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) @@ -6437,9 +6540,10 @@ namespace CalamityMod.NPCs #region SkeletronPrime else if (npc.type == NPCID.SkeletronPrime) { + bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; if (Main.netMode != 1) { - if (npc.ai[1] != 1f || (!CalamityWorld.death && (double)npc.life > (double)npc.lifeMax * 0.25) || CalamityWorld.bossRushActive) + if (npc.ai[1] != 1f || (!CalamityWorld.death && (double)npc.life > (double)npc.lifeMax * 0.25) || CalamityWorld.bossRushActive || targetFloatingUp) { npc.localAI[0] += 1f; if ((double)npc.life <= (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) @@ -6450,7 +6554,7 @@ namespace CalamityMod.NPCs { npc.localAI[0] += 1f; } - if (npc.localAI[0] >= (enraged ? 90f : 120f)) + if (npc.localAI[0] >= ((enraged || configBossRushBoost) ? 90f : 120f)) { npc.localAI[0] = 0f; Vector2 vector16 = npc.Center; @@ -6480,14 +6584,14 @@ namespace CalamityMod.NPCs } } } - if (CalamityWorld.death || (double)npc.life <= (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive) + if (CalamityWorld.death || (double)npc.life <= (double)npc.lifeMax * 0.25 || CalamityWorld.bossRushActive || targetFloatingUp) { newAI[0] += 1f; if (npc.ai[1] == 1f || CalamityWorld.bossRushActive) { newAI[0] += 3f; } - if (newAI[0] >= (enraged ? 180f : 240f)) //4 seconds or 1 second + if (newAI[0] >= ((enraged || configBossRushBoost) ? 180f : 240f)) //4 seconds or 1 second { newAI[0] = 0f; Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); @@ -6512,7 +6616,7 @@ namespace CalamityMod.NPCs } if (npc.ai[1] == 1f) { - int speed = CalamityWorld.bossRushActive ? 7 : 4; + int speed = CalamityWorld.bossRushActive ? 7 : 3; if ((double)npc.life <= (double)npc.lifeMax * 0.7) { speed++; @@ -6521,13 +6625,13 @@ namespace CalamityMod.NPCs { speed++; } - if (enraged) + if (enraged || configBossRushBoost) { speed += 3; } float speed2 = (float)speed; float speedBuff = 3f + (3f * (1f - (float)npc.life / (float)npc.lifeMax)); - float speedBuff2 = 11f + (11f * (1f - (float)npc.life / (float)npc.lifeMax)); + float speedBuff2 = 10f + (10f * (1f - (float)npc.life / (float)npc.lifeMax)); Vector2 vector45 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num444 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector45.X; float num445 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector45.Y; @@ -6541,6 +6645,10 @@ namespace CalamityMod.NPCs { speed2 = speedBuff2; } + if (targetFloatingUp) + { + speed2 += 5f; + } num446 = speed2 / num446; npc.velocity.X = num444 * num446; npc.velocity.Y = num445 * num446; @@ -6580,7 +6688,7 @@ namespace CalamityMod.NPCs npc.localAI[1] += 2f; } } - if (npc.localAI[1] > (enraged ? 90f : 120f)) + if (npc.localAI[1] > ((enraged || configBossRushBoost) ? 90f : 120f)) { npc.localAI[1] = 0f; npc.TargetClosest(true); @@ -6611,6 +6719,7 @@ namespace CalamityMod.NPCs #region TheTwins else if (npc.type == NPCID.Retinazer) { + bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; laserEye = npc.whoAmI; bool spazAlive = false; if (fireEye != -1) @@ -6620,7 +6729,7 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 0f) { double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8 : 0.6); - if ((double)npc.life < (double)npc.lifeMax * healthMult) + if ((double)npc.life < (double)npc.lifeMax * healthMult || targetFloatingUp) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -6658,12 +6767,21 @@ namespace CalamityMod.NPCs npc.ai[2] += (spazAlive ? 0.25f : 0.5f); npc.localAI[1] += (spazAlive ? 0.5f : 1f); } + if (targetFloatingUp) + { + npc.ai[2] += 1f; + npc.localAI[1] += 2f; + } newAI[0] += (spazAlive ? 1f : 2f); + if (targetFloatingUp) + { + newAI[0] += 2f; + } if (CalamityWorld.death || CalamityWorld.bossRushActive) { newAI[0] += 1f; } - if (newAI[0] >= (enraged ? 180f : 240f)) + if (newAI[0] >= ((enraged || configBossRushBoost) ? 180f : 240f)) { newAI[0] = 0f; Vector2 vector34 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); @@ -6693,6 +6811,7 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.Spazmatism) { + bool targetFloatingUp = Main.player[npc.target].gravDir == -1f; fireEye = npc.whoAmI; bool retAlive = false; if (laserEye != -1) @@ -6702,7 +6821,7 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 0f) { double healthMult = ((CalamityWorld.death || CalamityWorld.bossRushActive) ? 0.8 : 0.6); - if ((double)npc.life < (double)npc.lifeMax * healthMult) + if ((double)npc.life < (double)npc.lifeMax * healthMult || targetFloatingUp) { npc.ai[0] = 1f; npc.ai[1] = 0f; @@ -6736,7 +6855,7 @@ namespace CalamityMod.NPCs { newAI[0] += 1f; } - if (newAI[0] >= (enraged ? 20f : 30f)) + if (newAI[0] >= ((enraged || configBossRushBoost) ? 20f : 30f)) { newAI[0] = 0f; if (Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) @@ -6749,7 +6868,7 @@ namespace CalamityMod.NPCs num350 *= num351; if (Main.netMode != 1) { - float num418 = (enraged ? 25f : 18f); + float num418 = ((enraged || configBossRushBoost) ? 25f : 18f); int num419 = 30; int num420 = 96; num351 = (float)Math.Sqrt((double)(num349 * num349 + num350 * num350)); @@ -6765,9 +6884,15 @@ namespace CalamityMod.NPCs } } npc.ai[2] += (retAlive ? 1.5f : 2f); + if (targetFloatingUp) + { + npc.ai[2] += 1f; + npc.velocity.X *= 1.005f; + npc.velocity.Y *= 1.005f; + } npc.velocity.X *= 1.005f; npc.velocity.Y *= 1.005f; - if (enraged) + if (enraged || configBossRushBoost) { npc.velocity.X *= 1.01f; npc.velocity.Y *= 1.01f; @@ -6775,15 +6900,21 @@ namespace CalamityMod.NPCs } else { - npc.ai[2] += (retAlive ? 0.1f : 0.5f); - npc.velocity.X *= (retAlive ? 1.001f : 1.002f); - npc.velocity.Y *= (retAlive ? 1.001f : 1.002f); + npc.ai[2] += (retAlive ? 0f : 0.5f); + if (targetFloatingUp) + { + npc.ai[2] += 0.25f; + npc.velocity.X *= 1.001f; + npc.velocity.Y *= 1.001f; + } + npc.velocity.X *= (retAlive ? 1.001f : 1.0025f); + npc.velocity.Y *= (retAlive ? 1.001f : 1.0025f); if (CalamityWorld.death || CalamityWorld.bossRushActive) { - npc.velocity.X *= (retAlive ? 1.0005f : 1.001f); - npc.velocity.Y *= (retAlive ? 1.0005f : 1.001f); + npc.velocity.X *= (retAlive ? 1f : 1.001f); + npc.velocity.Y *= (retAlive ? 1f : 1.001f); } - if (enraged) + if (enraged || configBossRushBoost) { npc.velocity.X *= 1.003f; npc.velocity.Y *= 1.003f; @@ -6809,7 +6940,7 @@ namespace CalamityMod.NPCs } npc.defense = npc.defDefense + defenseUp; npc.localAI[0] = 0f; - int shootTime = (enraged ? 8 : 4); + int shootTime = ((enraged || configBossRushBoost) ? 8 : 4); if (CalamityWorld.bossRushActive) { shootTime += 1; @@ -6825,13 +6956,7 @@ namespace CalamityMod.NPCs { newAI[0] = 0f; npc.TargetClosest(true); - bool shootNoTileCollideLaser = false; - if (Main.rand.Next(3) == 0 || CalamityWorld.bossRushActive || newAI[2] > 0f) - { - shootNoTileCollideLaser = true; - } - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) || - shootNoTileCollideLaser) + 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 laserSpeedBoost = System.Math.Abs(Main.player[npc.target].velocity.X); if (System.Math.Abs(Main.player[npc.target].velocity.X) < System.Math.Abs(Main.player[npc.target].velocity.Y)) @@ -6862,7 +6987,7 @@ namespace CalamityMod.NPCs int num9 = 28; int num10 = 100; int value = (CalamityWorld.bossRushActive ? 3 : 4); - if (Main.rand.Next(value) == 0 || enraged) + if (Main.rand.Next(value) == 0 || enraged || configBossRushBoost) { int secondValue = (newAI[2] > 0f ? 3 : 5); num10 = (Main.rand.Next(secondValue) == 0 ? mod.ProjectileType("DestroyerHomingLaser") : 257); @@ -6882,10 +7007,6 @@ namespace CalamityMod.NPCs { Main.projectile[num11].timeLeft = 300; } - if (shootNoTileCollideLaser) - { - Main.projectile[num11].tileCollide = false; - } npc.netUpdate = true; } } @@ -6895,7 +7016,7 @@ namespace CalamityMod.NPCs #region WallofFlesh else if (npc.type == NPCID.WallofFlesh) { - if (enraged) + if (enraged || configBossRushBoost) { npc.velocity.X *= 1.7f; } @@ -6936,9 +7057,9 @@ namespace CalamityMod.NPCs } if (Main.netMode != 1) { - int num352 = (enraged ? 7 : 4); + int num352 = ((enraged || configBossRushBoost) ? 7 : 4); npc.localAI[1] = 0f; - npc.localAI[3] += (enraged ? 4f : 2f); + npc.localAI[3] += ((enraged || configBossRushBoost) ? 4f : 2f); if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.75) { npc.localAI[3] += 1f; @@ -6978,7 +7099,7 @@ namespace CalamityMod.NPCs } if (flag30) { - float num353 = (enraged ? 14f : 10f); + float num353 = ((enraged || configBossRushBoost) ? 14f : 10f); int num354 = 18; int num355 = 83; if ((double)Main.npc[Main.wof].life < (double)Main.npc[Main.wof].lifeMax * 0.5) @@ -7024,7 +7145,7 @@ namespace CalamityMod.NPCs { if (Main.npc[(int)npc.ai[1]].ai[1] == 0f) { - npc.ai[3] += (enraged ? 1.5f : 0.5f); + npc.ai[3] += ((enraged || configBossRushBoost) ? 1.5f : 0.5f); if (CalamityWorld.death || CalamityWorld.bossRushActive) { npc.ai[3] += 1f; @@ -7038,7 +7159,7 @@ namespace CalamityMod.NPCs { if (Main.netMode != 1) { - npc.localAI[1] += (enraged ? 6f : 3f); + npc.localAI[1] += ((enraged || configBossRushBoost) ? 6f : 3f); if ((double)npc.life <= (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) { npc.localAI[1] += 3f; @@ -7083,7 +7204,7 @@ namespace CalamityMod.NPCs float num174 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector20.Y; float num175 = (float)Math.Sqrt((double)(num173 * num173 + num174 * num174)); float num176 = CalamityWorld.bossRushActive ? 10f : 5f; - if (enraged) { num176 += 3f; } + if (enraged || configBossRushBoost) { num176 += 3f; } if (num175 > 150f) { num176 *= 1.05f; @@ -7376,6 +7497,42 @@ namespace CalamityMod.NPCs } } #endregion + #region BasicEnemies + else if (npc.type == NPCID.Lihzahrd) + { + if (Main.netMode != 1 && (double)npc.life <= (double)npc.lifeMax * 0.9) + { + npc.Transform(NPCID.LihzahrdCrawler); + } + } + else if (npc.type == NPCID.IceGolem) + { + float num63 = 2f; + float num64 = 0.14f; + num63 += (1f - (float)npc.life / (float)npc.lifeMax) * 1.5f; + num64 += (1f - (float)npc.life / (float)npc.lifeMax) * 0.15f; + if (npc.velocity.X < -num63 || npc.velocity.X > num63) + { + return; + } + else if (npc.velocity.X < num63 && npc.direction == 1) + { + npc.velocity.X = npc.velocity.X + num64; + if (npc.velocity.X > num63) + { + npc.velocity.X = num63; + } + } + else if (npc.velocity.X > -num63 && npc.direction == -1) + { + npc.velocity.X = npc.velocity.X - num64; + if (npc.velocity.X < -num63) + { + npc.velocity.X = -num63; + } + } + } + #endregion } #endregion } @@ -7927,7 +8084,7 @@ namespace CalamityMod.NPCs npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid") && npc.type != NPCID.DD2Betsy) { if (!CalamityPlayer.areThereAnyDamnBosses) - damage = npc.lifeMax * 5; + damage = npc.lifeMax * 3; } } if (Main.player[projectile.owner].GetModPlayer(mod).eTalisman) @@ -7938,7 +8095,7 @@ namespace CalamityMod.NPCs npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid") && npc.type != NPCID.DD2Betsy) { if (!CalamityPlayer.areThereAnyDamnBosses) - damage = npc.lifeMax * 5; + damage = npc.lifeMax * 3; } } if (Main.player[projectile.owner].GetModPlayer(mod).nanotech) @@ -7950,7 +8107,7 @@ namespace CalamityMod.NPCs npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid") && npc.type != NPCID.DD2Betsy) { if (!CalamityPlayer.areThereAnyDamnBosses) - damage = npc.lifeMax * 5; + damage = npc.lifeMax * 3; } } if (Main.player[projectile.owner].GetModPlayer(mod).eQuiver) @@ -7961,7 +8118,7 @@ namespace CalamityMod.NPCs npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid") && npc.type != NPCID.DD2Betsy) { if (!CalamityPlayer.areThereAnyDamnBosses) - damage = npc.lifeMax * 5; + damage = npc.lifeMax * 3; } } if (Main.player[projectile.owner].GetModPlayer(mod).statisBeltOfCurses) @@ -7972,7 +8129,7 @@ namespace CalamityMod.NPCs npc.type != mod.NPCType("EidolonWyrmHead") && npc.type != mod.NPCType("EidolonWyrmHeadHuge") && npc.type != mod.NPCType("ColossalSquid") && npc.type != NPCID.DD2Betsy) { if (!CalamityPlayer.areThereAnyDamnBosses) - damage = npc.lifeMax * 5; + damage = npc.lifeMax * 3; } } } @@ -8075,3412 +8232,62 @@ namespace CalamityMod.NPCs } #endregion - #region PreNPCLoot - public override bool PreNPCLoot(NPC npc) + #region HitEffect + public override void HitEffect(NPC npc, int hitDirection, double damage) { - #region BossRush - if (CalamityWorld.bossRushActive) - { - if (npc.type == mod.NPCType("ProfanedGuardianBoss")) - { - CalamityWorld.bossRushStage = 7; - DespawnProj(); - } - else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) - { - if (npc.boss) - { - CalamityWorld.bossRushStage = 8; - DespawnProj(); - } - } - else if (npc.type == mod.NPCType("Astrageldon")) - { - CalamityWorld.bossRushStage = 9; - DespawnProj(); - } - else if (npc.type == mod.NPCType("Bumblefuck")) - { - CalamityWorld.bossRushStage = 12; - DespawnProj(); - } - else if (npc.type == mod.NPCType("HiveMindP2")) - { - CalamityWorld.bossRushStage = 14; - DespawnProj(); - } - else if (npc.type == mod.NPCType("StormWeaverHeadNaked")) - { - CalamityWorld.bossRushStage = 16; - DespawnProj(); - } - else if (npc.type == mod.NPCType("AquaticScourgeHead")) - { - CalamityWorld.bossRushStage = 17; - DespawnProj(); - } - else if (npc.type == mod.NPCType("DesertScourgeHead")) - { - CalamityWorld.bossRushStage = 18; - DespawnProj(); - } - else if (npc.type == mod.NPCType("CrabulonIdle")) - { - CalamityWorld.bossRushStage = 20; - DespawnProj(); - } - else if (npc.type == mod.NPCType("CeaselessVoid")) - { - CalamityWorld.bossRushStage = 22; - DespawnProj(); - } - else if (npc.type == mod.NPCType("PerforatorHive")) - { - CalamityWorld.bossRushStage = 23; - DespawnProj(); - } - else if (npc.type == mod.NPCType("Cryogen")) - { - CalamityWorld.bossRushStage = 24; - DespawnProj(); - } - else if (npc.type == mod.NPCType("BrimstoneElemental")) - { - CalamityWorld.bossRushStage = 25; - DespawnProj(); - } - else if (npc.type == mod.NPCType("CosmicWraith")) - { - CalamityWorld.bossRushStage = 26; - DespawnProj(); - string key = "Mods.CalamityMod.BossRushTierThreeEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (npc.type == mod.NPCType("ScavengerBody")) - { - CalamityWorld.bossRushStage = 27; - DespawnProj(); - } - else if (npc.type == mod.NPCType("AstrumDeusHeadSpectral")) - { - CalamityWorld.bossRushStage = 30; - DespawnProj(); - } - else if (npc.type == mod.NPCType("Polterghast")) - { - CalamityWorld.bossRushStage = 31; - DespawnProj(); - } - else if (npc.type == mod.NPCType("PlaguebringerGoliath")) - { - CalamityWorld.bossRushStage = 32; - DespawnProj(); - } - else if (npc.type == mod.NPCType("CalamitasRun3")) - { - CalamityWorld.bossRushStage = 33; - DespawnProj(); - string key = "Mods.CalamityMod.BossRushTierFourEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - else if (npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("Leviathan")) - { - int bossType = (npc.type == mod.NPCType("Siren")) ? mod.NPCType("Leviathan") : mod.NPCType("Siren"); - if (!NPC.AnyNPCs(bossType)) - { - CalamityWorld.bossRushStage = 34; - DespawnProj(); - } - } - else if (npc.type == mod.NPCType("SlimeGodCore") || npc.type == mod.NPCType("SlimeGodSplit") || npc.type == mod.NPCType("SlimeGodRunSplit")) - { - if (npc.type == mod.NPCType("SlimeGodCore") && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) - && !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) - { - CalamityWorld.bossRushStage = 35; - DespawnProj(); - } - else if (npc.type == mod.NPCType("SlimeGodSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) && - NPC.CountNPCS(mod.NPCType("SlimeGodSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) - { - CalamityWorld.bossRushStage = 35; - DespawnProj(); - } - else if (npc.type == mod.NPCType("SlimeGodRunSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && - NPC.CountNPCS(mod.NPCType("SlimeGodRunSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGod"))) - { - CalamityWorld.bossRushStage = 35; - DespawnProj(); - } - } - else if (npc.type == mod.NPCType("Providence")) - { - CalamityWorld.bossRushStage = 36; - DespawnProj(); - } - else if (npc.type == mod.NPCType("SupremeCalamitas")) - { - CalamityWorld.bossRushStage = 37; - DespawnProj(); - } - else if (npc.type == mod.NPCType("Yharon")) - { - CalamityWorld.bossRushStage = 38; - DespawnProj(); - } - else if (npc.type == mod.NPCType("DevourerofGodsHeadS")) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Rock"), 1, true); - CalamityWorld.bossRushStage = 0; - DespawnProj(); - CalamityWorld.bossRushActive = false; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(CalamityWorld.bossRushStage); - netMessage.Send(); - } - string key = "Mods.CalamityMod.BossRushTierFiveEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - return false; - } - switch (npc.type) - { - case NPCID.QueenBee: - CalamityWorld.bossRushStage = 1; - DespawnProj(); - break; - case NPCID.BrainofCthulhu: - CalamityWorld.bossRushStage = 2; - DespawnProj(); - break; - case NPCID.KingSlime: - CalamityWorld.bossRushStage = 3; - DespawnProj(); - break; - case NPCID.EyeofCthulhu: - CalamityWorld.bossRushStage = 4; - DespawnProj(); - break; - case NPCID.SkeletronPrime: - CalamityWorld.bossRushStage = 5; - DespawnProj(); - break; - case NPCID.Golem: - CalamityWorld.bossRushStage = 6; - DespawnProj(); - break; - case NPCID.TheDestroyer: - CalamityWorld.bossRushStage = 10; - DespawnProj(); - string key = "Mods.CalamityMod.BossRushTierOneEndText"; - Color messageColor = Color.LightCoral; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - break; - case NPCID.Spazmatism: - CalamityWorld.bossRushStage = 11; - DespawnProj(); - break; - case NPCID.Retinazer: - CalamityWorld.bossRushStage = 11; - DespawnProj(); - break; - case NPCID.WallofFlesh: - CalamityWorld.bossRushStage = 13; - DespawnProj(); - break; - case NPCID.SkeletronHead: - CalamityWorld.bossRushStage = 15; - DespawnProj(); - break; - case NPCID.CultistBoss: - CalamityWorld.bossRushStage = 19; - DespawnProj(); - string key2 = "Mods.CalamityMod.BossRushTierTwoEndText"; - Color messageColor2 = Color.LightCoral; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - break; - case NPCID.Plantera: - CalamityWorld.bossRushStage = 21; - DespawnProj(); - break; - case NPCID.DukeFishron: - CalamityWorld.bossRushStage = 28; - DespawnProj(); - break; - case NPCID.MoonLordCore: - CalamityWorld.bossRushStage = 29; - DespawnProj(); - break; - default: - break; - } - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.BossRushStage); - netMessage.Write(CalamityWorld.bossRushStage); - netMessage.Send(); - } - return false; - } - #endregion - #region AbyssDropCancel - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int abyssChasmY = y - 250; - int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); - bool abyssPosX = false; - bool abyssPosY = ((double)(npc.position.Y / 16f) <= abyssChasmY); - if (CalamityWorld.abyssSide) - { - if ((double)(npc.position.X / 16f) < abyssChasmX + 80) - { - abyssPosX = true; - } - } - else - { - if ((double)(npc.position.X / 16f) > abyssChasmX - 80) - { - abyssPosX = true; - } - } - bool hurtByAbyss = (npc.wet && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && - ((((double)(npc.position.Y / 16f) > (Main.rockLayer - (double)Main.maxTilesY * 0.05)) && - abyssPosY && abyssPosX) || CalamityWorld.abyssTiles > 200) && - !npc.buffImmune[mod.BuffType("CrushDepth")]); - if (hurtByAbyss) - { - return false; - } - #endregion if (CalamityWorld.revenge) { - if (npc.type == NPCID.Probe) + switch (npc.type) { - return false; - } - } - if (!NPC.downedMechBossAny && (npc.type == NPCID.Spazmatism || npc.type == NPCID.TheDestroyer || npc.type == NPCID.SkeletronPrime)) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge20")); - } - if (!NPC.downedSlimeKing && npc.type == NPCID.KingSlime) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); - } - else if (!NPC.downedBoss1 && npc.type == NPCID.EyeofCthulhu) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge3")); - } - else if (!NPC.downedQueenBee && npc.type == NPCID.QueenBee) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge16")); - } - else if (!NPC.downedMechBoss1 && npc.type == NPCID.TheDestroyer) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge21")); - } - else if (!NPC.downedMechBoss2 && npc.type == NPCID.Spazmatism) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge22")); - } - else if (!NPC.downedMechBoss3 && npc.type == NPCID.SkeletronPrime) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge23")); - } - else if (!NPC.downedPlantBoss && npc.type == NPCID.Plantera) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge25")); - } - else if (!NPC.downedFishron && npc.type == NPCID.DukeFishron) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge2")); - } - else if (npc.type == NPCID.CultistBoss) - { - if (!NPC.downedAncientCultist) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge4")); - } - if (Main.bloodMoon) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge34")); - } - } - return true; - } - #endregion - - #region NPCLoot - public override void NPCLoot(NPC npc) - { - bool revenge = CalamityWorld.revenge; - if (DraedonMayhem) - { - if (!CalamityPlayer.areThereAnyDamnBosses) - { - DraedonMayhem = false; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - } - #region DefiledLoot - if (CalamityWorld.defiled) - { - if (npc.type == NPCID.AnglerFish || npc.type == NPCID.Werewolf) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AdhesiveBandage); - } - if (npc.type == NPCID.Werewolf) - { - if (Main.rand.Next(20) == 0) + case NPCID.MotherSlime: + if (npc.life <= 0) { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MoonCharm); - } - } - } - else if (npc.type == NPCID.DesertBeast) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AncientHorn); - } - } - else if (npc.type == NPCID.ArmoredSkeleton) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BeamSword); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ArmorPolish); - } - } - else if (npc.type == NPCID.Clown) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bananarang); - } - } - else if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || npc.type == NPCID.ToxicSludge) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bezoar); - } - if (npc.type == NPCID.MossHornet) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TatteredBeeWing); - } - } - } - else if (npc.type == NPCID.EyeofCthulhu) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Binoculars); - } - } - else if (npc.type == NPCID.DemonEye || npc.type == NPCID.WanderingEye) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlackLens); - } - } - else if (npc.type == NPCID.CorruptSlime || npc.type == NPCID.DarkMummy) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Blindfold); - } - } - else if (npc.type >= 269 && npc.type <= 280) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Keybrand); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BoneFeather); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MagnetSphere); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WispinaBottle); - } - } - else if (npc.type == NPCID.UndeadMiner) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BonePickaxe); - } - } - else if (npc.type == NPCID.Skeleton) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BoneSword); - } - } - else if (npc.type == NPCID.ScutlixRider) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BrainScrambler); - } - } - else if (npc.type == NPCID.Vampire) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BrokenBatWing); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MoonStone); - } - } - else if (npc.type == NPCID.CaveBat) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ChainKnife); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DepthMeter); - } - } - else if (npc.type == NPCID.DarkCaster || npc.type == NPCID.AngryBones) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ClothierVoodooDoll); - } - } - else if (npc.type == NPCID.PirateCaptain) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CoinGun); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DiscountCard); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Cutlass); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.LuckyCoin); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.PirateStaff); - } - } - else if (npc.type == NPCID.Reaper) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DeathSickle); - } - } - else if (npc.type == NPCID.Demon) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DemonScythe); - } - } - else if (npc.type == NPCID.DesertDjinn) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DjinnLamp); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DjinnsCurse); - } - } - else if (npc.type == NPCID.Shark) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DivingHelmet); - } - } - else if (npc.type == NPCID.Pixie || npc.type == NPCID.Wraith || npc.type == NPCID.Mummy) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FastClock); - } - } - else if (npc.type == NPCID.RedDevil) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FireFeather); - } - } - else if (npc.type == NPCID.IceElemental || npc.type == NPCID.IcyMerman || npc.type == NPCID.ArmoredViking || npc.type == NPCID.IceTortoise) - { - if (npc.type == NPCID.IceElemental || npc.type == NPCID.IcyMerman) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FrostStaff); - } - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.IceSickle); - } - if (npc.type == NPCID.IceTortoise) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FrozenTurtleShell); - } - } - } - else if (npc.type == NPCID.Harpy && Main.hardMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GiantHarpyFeather); - } - } - else if (npc.type == mod.NPCType("SunBat")) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HelFire); - } - } - else if (npc.type == mod.NPCType("Cryon")) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amarok); - } - } - else if (npc.type == NPCID.QueenBee) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HoneyedGoggles); - } - } - else if (npc.type == NPCID.Piranha) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Hook); - } - } - else if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.InfernoFork); - } - } - else if (npc.type == NPCID.PinkJellyfish) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.JellyfishNecklace); - } - } - else if (npc.type == NPCID.Paladin) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Kraken); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.PaladinsHammer); - } - } - else if (npc.type == NPCID.SkeletonArcher) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MagicQuiver); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Marrow); - } - } - else if (npc.type == NPCID.Lavabat) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MagmaStone); - } - } - else if (npc.type == NPCID.WalkingAntlion) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AntlionClaw); - } - } - else if (npc.type == NPCID.DarkMummy || npc.type == NPCID.GreenJellyfish) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Megaphone); - } - } - else if (npc.type == NPCID.CursedSkull) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); - } - } - else if (npc.type == NPCID.FireImp) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ObsidianRose); - } - } - else if (npc.type == NPCID.BlackRecluse || npc.type == NPCID.BlackRecluseWall) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.PoisonStaff); - } - } - else if (npc.type == NPCID.SkeletonSniper) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.RifleScope); - } - } - else if (npc.type == NPCID.ChaosElemental) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.RodofDiscord); - } - } - else if (npc.type == NPCID.Necromancer || npc.type == NPCID.NecromancerArmored) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ShadowbeamStaff); - } - } - else if (npc.type == NPCID.SnowFlinx) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SnowballLauncher); - } - } - else if (npc.type == NPCID.RaggedCaster) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SpectreStaff); - } - } - else if (npc.type == NPCID.Plantera) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TheAxe); - } - } - else if (npc.type == NPCID.GiantBat) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TrifoldMap); - } - } - else if (npc.type == NPCID.AngryTrapper) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Uzi); - } - } - else if (npc.type == NPCID.FloatyGross || npc.type == NPCID.Corruptor) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vitamins); - } - } - else if (NPC.downedMechBossAny && npc.type == NPCID.GiantTortoise) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Yelets); - } - } - } - #endregion - #region ArmageddonLoot - if (CalamityWorld.armageddon) - { - int dropAmt = 5; - if (npc.type == NPCID.Golem) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.DukeFishron) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.DD2Betsy) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.EyeofCthulhu) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.BrainofCthulhu) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) - { - if (npc.boss) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - } - else if (npc.type == NPCID.QueenBee) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.SkeletronHead) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.WallofFlesh) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.MoonLordCore) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.KingSlime) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism) - { - int num64 = NPCID.Retinazer; - if (npc.type == NPCID.Retinazer) - { - num64 = NPCID.Spazmatism; - } - if (!NPC.AnyNPCs(num64)) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - } - else if (npc.type == NPCID.SkeletronPrime) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.TheDestroyer) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - else if (npc.type == NPCID.Plantera) - { - for (int i = 0; i < dropAmt; i++) - { - npc.DropBossBags(); - } - } - } - #endregion - #region AdrenalineReset - if (npc.boss && CalamityWorld.revenge) - { - if (npc.type != mod.NPCType("HiveMind") && npc.type != mod.NPCType("Leviathan") && npc.type != mod.NPCType("Siren") && - npc.type != mod.NPCType("StormWeaverHead") && npc.type != mod.NPCType("StormWeaverBody") && - npc.type != mod.NPCType("StormWeaverTail") && npc.type != mod.NPCType("DevourerofGodsHead") && - npc.type != mod.NPCType("DevourerofGodsBody") && npc.type != mod.NPCType("DevourerofGodsTail")) - { - if (Main.netMode != 2) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - Main.player[Main.myPlayer].GetModPlayer(mod).adrenaline = 0; - } - } - } - } - #endregion - #region SpawnPolterghast - if ((npc.type == mod.NPCType("PhantomSpirit") || npc.type == mod.NPCType("PhantomSpiritS") || npc.type == mod.NPCType("PhantomSpiritM") || - npc.type == mod.NPCType("PhantomSpiritL")) && !NPC.AnyNPCs(mod.NPCType("Polterghast")) && !CalamityWorld.downedPolterghast) - { - CalamityMod.ghostKillCount++; - if (CalamityMod.ghostKillCount >= 30 && Main.netMode != 1) - { - int lastPlayer = npc.lastInteraction; - if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) - { - lastPlayer = npc.FindClosestPlayer(); - } - if (lastPlayer >= 0) - { - NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("Polterghast")); - CalamityMod.ghostKillCount = 0; - } - } - } - #endregion - #region SpawnGSS - if ((NPC.downedPlantBoss || CalamityWorld.downedCalamitas) && npc.type == NPCID.SandShark && !NPC.AnyNPCs(mod.NPCType("GreatSandShark"))) - { - CalamityMod.sharkKillCount++; - if (CalamityMod.sharkKillCount >= 10 && Main.netMode != 1) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), - (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); - } - int lastPlayer = npc.lastInteraction; - if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) - { - lastPlayer = npc.FindClosestPlayer(); - } - if (lastPlayer >= 0) - { - NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("GreatSandShark")); - CalamityMod.sharkKillCount = -10; - } - } - } - #endregion - #region WormLootFromNearestSegment - if (npc.type == mod.NPCType("DesertScourgeHead")) - { - Vector2 center = Main.player[npc.target].Center; - float num2 = 1E+08f; - Vector2 position2 = npc.position; - for (int k = 0; k < 200; k++) - { - if (Main.npc[k].active && (Main.npc[k].type == mod.NPCType("DesertScourgeHead") || Main.npc[k].type == mod.NPCType("DesertScourgeBody") || Main.npc[k].type == mod.NPCType("DesertScourgeTail"))) - { - float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); - if (num3 < num2) - { - num2 = num3; - position2 = Main.npc[k].position; - } - } - } - npc.position = position2; - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.LesserHealingPotion, Main.rand.Next(8, 15)); - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertScourgeTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(7, 15)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(5, 10)); - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeaboundStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Barinade")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StormSpray")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AquaticDischarge")); - } - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertScourgeMask")); - } - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HighTestFishingLine); - } - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerTackleBag); - } - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TackleBox); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerEarring); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishermansGuide); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WeatherRadio); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sextant); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerHat); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerVest); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerPants); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CratePotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishingPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SonarPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(10) == 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AeroStone"), 1, true); - } - if (NPC.downedBoss3) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldenBugNet); - } - } - } - if (!CalamityWorld.downedDesertScourge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge")); - } - string key = "Mods.CalamityMod.OpenSunkenSea"; - Color messageColor = Color.Aquamarine; - if (!CalamityWorld.downedDesertScourge) - { - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - CalamityWorld.downedDesertScourge = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("AquaticScourgeHead")) - { - Vector2 center = Main.player[npc.target].Center; - float num2 = 1E+08f; - Vector2 position2 = npc.position; - for (int k = 0; k < 200; k++) - { - if (Main.npc[k].active && - (Main.npc[k].type == mod.NPCType("AquaticScourgeHead") || - Main.npc[k].type == mod.NPCType("AquaticScourgeBody") || - Main.npc[k].type == mod.NPCType("AquaticScourgeBodyAlt") || - Main.npc[k].type == mod.NPCType("AquaticScourgeTail"))) - { - float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); - if (num3 < num2) - { - num2 = num3; - position2 = Main.npc[k].position; - } - } - } - npc.position = position2; - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GreaterHealingPotion, Main.rand.Next(8, 15)); - if (Main.hardMode) - { - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(11, 21)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SoulofSight, Main.rand.Next(20, 41)); - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DeepseaStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Barinautical")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Downpour")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SubmarineShocker")); - } - if (Main.rand.Next(8) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HighTestFishingLine); - } - if (Main.rand.Next(8) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerTackleBag); - } - if (Main.rand.Next(8) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TackleBox); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerEarring); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishermansGuide); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WeatherRadio); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sextant); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerHat); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerVest); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerPants); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CratePotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishingPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SonarPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AeroStone"), 1, true); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldenBugNet); - } - } - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(11, 21)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(5, 10)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(5, 10)); - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HighTestFishingLine); - } - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerTackleBag); - } - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TackleBox); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerEarring); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishermansGuide); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WeatherRadio); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sextant); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerHat); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerVest); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerPants); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CratePotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishingPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SonarPotion, Main.rand.Next(2, 4)); - } - if (Main.rand.Next(10) == 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AeroStone"), 1, true); - } - if (NPC.downedBoss3) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldenBugNet); - } - } - } - if (!CalamityWorld.downedAquaticScourge) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge27")); - } - CalamityWorld.downedAquaticScourge = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("AstrumDeusHeadSpectral")) - { - Vector2 center = Main.player[npc.target].Center; - float num2 = 1E+08f; - Vector2 position2 = npc.position; - for (int k = 0; k < 200; k++) - { - if (Main.npc[k].active && (Main.npc[k].type == mod.NPCType("AstrumDeusHeadSpectral") || Main.npc[k].type == mod.NPCType("AstrumDeusBodySpectral") || Main.npc[k].type == mod.NPCType("AstrumDeusTailSpectral"))) - { - float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); - if (num3 < num2) - { - num2 = num3; - position2 = Main.npc[k].position; - } - } - } - npc.position = position2; - string key = "Mods.CalamityMod.AstralBossText"; - Color messageColor = Color.Gold; - if (!CalamityWorld.downedStarGod) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge29")); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - CalamityWorld.downedStarGod = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GreaterHealingPotion, Main.rand.Next(8, 15)); - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstrumDeusTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(50, 81)); - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HallowedKey); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Starfall")); - } - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Nebulash")); - } - if (Main.rand.Next(7) == 0) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AstrumDeusMask"), 1, true); - } - } - } - else if (npc.type == mod.NPCType("DevourerofGodsHead")) - { - CalamityWorld.DoGSecondStageCountdown = 21600; //6 minutes - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - for (int playerIndex = 0; playerIndex < 255; playerIndex++) - { - if (Main.player[playerIndex].active) - { - Player player = Main.player[playerIndex]; - for (int l = 0; l < 22; l++) - { - int hasBuff = player.buffType[l]; - if (hasBuff == mod.BuffType("AdrenalineMode")) + if (Main.netMode != 1) { - player.DelBuff(l); - l = -1; - } - if (hasBuff == mod.BuffType("RageMode")) - { - player.DelBuff(l); - l = -1; + int num261 = Main.rand.Next(2) + 2; + int num; + for (int num262 = 0; num262 < num261; num262 = num + 1) + { + int num263 = NPC.NewNPC((int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), 1, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num263].SetDefaults(-5, -1f); + Main.npc[num263].velocity.X = npc.velocity.X * 2f; + Main.npc[num263].velocity.Y = npc.velocity.Y; + NPC var_324_BB1A_cp_0_cp_0 = Main.npc[num263]; + var_324_BB1A_cp_0_cp_0.velocity.X = var_324_BB1A_cp_0_cp_0.velocity.X + ((float)Main.rand.Next(-20, 20) * 0.1f + (float)(num262 * npc.direction) * 0.3f); + NPC var_324_BB6F_cp_0_cp_0 = Main.npc[num263]; + var_324_BB6F_cp_0_cp_0.velocity.Y = var_324_BB6F_cp_0_cp_0.velocity.Y - ((float)Main.rand.Next(0, 10) * 0.1f + (float)num262); + Main.npc[num263].ai[0] = (float)(-1000 * Main.rand.Next(3)); + if (Main.netMode == 2 && num263 < 200) + { + NetMessage.SendData(23, -1, -1, null, num263, 0f, 0f, 0f, 0, 0, 0); + } + num = num262; + } } } - } + break; + case NPCID.Demon: + case NPCID.VoodooDemon: + npc.ai[0] += 1f; + break; + case NPCID.CursedHammer: + case NPCID.EnchantedSword: + case NPCID.Clinger: + case NPCID.Gastropod: + case NPCID.GiantTortoise: + case NPCID.IceTortoise: + case NPCID.BlackRecluse: + case NPCID.BlackRecluseWall: + case NPCID.CrimsonAxe: + case NPCID.Paladin: + npc.justHit = false; + break; + case NPCID.Clown: + if (Main.netMode != 1 && !Main.player[npc.target].dead) + npc.ai[2] += 29f; + break; } } - else if (npc.type == mod.NPCType("DevourerofGodsHeadS")) - { - Vector2 center = Main.player[npc.target].Center; - float num2 = 1E+08f; - Vector2 position2 = npc.position; - for (int k = 0; k < 200; k++) - { - if (Main.npc[k].active && (Main.npc[k].type == mod.NPCType("DevourerofGodsHeadS") || Main.npc[k].type == mod.NPCType("DevourerofGodsBodyS") || Main.npc[k].type == mod.NPCType("DevourerofGodsTailS"))) - { - float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); - if (num3 < num2) - { - num2 = num3; - position2 = Main.npc[k].position; - } - } - } - npc.position = position2; - string key = "Mods.CalamityMod.DoGBossText"; - Color messageColor = Color.Cyan; - string key2 = "Mods.CalamityMod.DoGBossText2"; - Color messageColor2 = Color.Orange; - if (!CalamityWorld.downedDoG) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 6); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 3); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells"), 2); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - } - CalamityWorld.downedDoG = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SupremeHealingPotion"), Main.rand.Next(8, 15)); - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DevourerofGodsTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DevourerofGodsMask")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DeathhailStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Excelsus")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheObliterator")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Eradicator")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EradicatorMelee")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Deathwind")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaffoftheMechworm")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CosmiliteBar"), Main.rand.Next(25, 35)); - } - } - #endregion - #region ArmorSetLoot - if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).tarraSet) - { - if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && npc.lifeMax > 100 && Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 58, 1, false, 0, false, false); - } - } - if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).bloodflareSet) - { - if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && Main.rand.Next(2) == 0 && Main.bloodMoon && npc.HasPlayerTarget && (double)(npc.position.Y / 16f) < Main.worldSurface) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodOrb")); - } - } - if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && Main.rand.Next(12) == 0 && Main.bloodMoon && npc.HasPlayerTarget && (double)(npc.position.Y / 16f) < Main.worldSurface) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodOrb")); - } - #endregion - #region Thingyouwillneverget - if (npc.type == mod.NPCType("Yharon") && Main.rand.Next(100) == 0 && npc.localAI[2] == 1f) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YharimsCrystal")); - } - #endregion - #region Rares - if (npc.type == NPCID.PossessedArmor) - { - if (Main.expertMode) - { - if (Main.rand.Next(150) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PsychoticAmulet")); - } - } - else if (Main.rand.Next(200) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PsychoticAmulet")); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PsychoticAmulet")); - } - } - } - else if (npc.type == NPCID.SeaSnail) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeaShell")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeaShell")); - } - } - else if (npc.type == NPCID.GiantTortoise) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantTortoiseShell")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantTortoiseShell")); - } - } - else if (npc.type == NPCID.GiantShelly || npc.type == NPCID.GiantShelly2) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantShell")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantShell")); - } - } - else if (npc.type == NPCID.AnomuraFungus) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FungalCarapace")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FungalCarapace")); - } - } - else if (npc.type == NPCID.Crawdad || npc.type == NPCID.Crawdad2) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrawCarapace")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrawCarapace")); - } - } - else if (npc.type == NPCID.GreenJellyfish) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VitalJelly")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VitalJelly")); - } - } - else if (npc.type == NPCID.PinkJellyfish) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); - } - } - else if (npc.type == NPCID.BlueJellyfish) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); - } - } - else if (npc.type == NPCID.MossHornet) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Needler")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Needler")); - } - } - else if (npc.type == NPCID.DarkCaster) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientShiv")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientShiv")); - } - } - else if (npc.type == NPCID.BigMimicCorruption || npc.type == NPCID.BigMimicCrimson || npc.type == NPCID.BigMimicHallow || npc.type == NPCID.BigMimicJungle) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CelestialClaymore")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CelestialClaymore")); - } - } - else if (npc.type == NPCID.Clinger) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CursedDagger")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CursedDagger")); - } - } - else if (npc.type == NPCID.Shark) - { - if (Main.expertMode) - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthBlade")); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkToothNecklace); - } - } - else - { - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthBlade")); - } - if (Main.rand.Next(30) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkToothNecklace); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkToothNecklace); - } - } - } - } - else if (npc.type == NPCID.PresentMimic) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HolidayHalberd")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HolidayHalberd")); - } - } - else if (npc.type == NPCID.IchorSticker) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("IchorSpear")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("IchorSpear")); - } - } - else if (npc.type == NPCID.Harpy && NPC.downedBoss1) - { - if (Main.expertMode) - { - if (Main.rand.Next(30) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SkyGlaze")); - } - } - else if (Main.rand.Next(40) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SkyGlaze")); - } - if (CalamityWorld.defiled) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SkyGlaze")); - } - } - } - else if (npc.type == NPCID.Antlion || npc.type == NPCID.WalkingAntlion || npc.type == NPCID.FlyingAntlion) - { - if (Main.expertMode) - { - if (Main.rand.Next(30) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleBow")); - } - if (Main.rand.Next(30) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleClaws")); - } - } - else - { - if (Main.rand.Next(40) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleBow")); - } - if (Main.rand.Next(40) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleClaws")); - } - } - } - else if (npc.type == NPCID.MartianSaucerCore) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NullificationRifle")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NullificationRifle")); - } - } - else if (npc.type == NPCID.Demon) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BladecrestOathsword")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BladecrestOathsword")); - } - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); - } - } - else if (npc.type == NPCID.BoneSerpentHead) - { - if (Main.expertMode) - { - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OldLordOathsword")); - } - } - else if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OldLordOathsword")); - } - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); - } - } - else if (npc.type == NPCID.Tim) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); - } - } - else if (npc.type == NPCID.GoblinSorcerer) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); - } - } - else if (npc.type == NPCID.PirateDeadeye) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProporsePistol")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProporsePistol")); - } - } - else if (npc.type == NPCID.PirateCrossbower) - { - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RaidersGlory")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RaidersGlory")); - } - } - else if (npc.type == NPCID.GoblinSummoner) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheFirstShadowflame")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheFirstShadowflame")); - } - } - else if (npc.type == NPCID.SandElemental) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WifeinaBottle")); - } - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WifeinaBottlewithBoobs")); - } - } - else - { - if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WifeinaBottle")); - } - } - } - else if (npc.type == NPCID.Skeleton || npc.type == NPCID.ArmoredSkeleton) - { - if (Main.expertMode) - { - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Waraxe")); - } - } - else if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Waraxe")); - } - if (Main.expertMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); - } - } - else if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); - } - } - else if (npc.type == NPCID.GoblinWarrior) - { - if (Main.expertMode) - { - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Warblade")); - } - } - else if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Warblade")); - } - } - else if (npc.type == NPCID.MartianWalker) - { - if (Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Wingman")); - } - } - else if (Main.rand.Next(7) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Wingman")); - } - } - else if (npc.type == NPCID.GiantCursedSkull || npc.type == NPCID.NecromancerArmored || npc.type == NPCID.Necromancer) - { - if (npc.type == NPCID.GiantCursedSkull) - { - if (CalamityWorld.downedLeviathan && Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Keelhaul")); - } - } - if (Main.expertMode) - { - if (Main.rand.Next(20) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WrathoftheAncients")); - } - } - else if (Main.rand.Next(25) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WrathoftheAncients")); - } - } - #endregion - #region Commons - if (npc.type == NPCID.Vulture) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertFeather"), Main.rand.Next(1, 3)); - } - } - else if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertFeather")); - } - } - else if (CalamityMod.dungeonEnemyBuffList.Contains(npc.type)) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Ectoblood"), Main.rand.Next(1, 3)); - } - } - else if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Ectoblood")); - } - } - else if (npc.type == NPCID.RedDevil) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); - } - } - else if (npc.type == NPCID.WyvernHead) - { - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder"), Main.rand.Next(1, 3)); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); - } - } - else if (npc.type == NPCID.AngryNimbus) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); - } - } - else if (npc.type == NPCID.IceTortoise || npc.type == NPCID.IcyMerman) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum")); - } - } - else if (npc.type == NPCID.Plantera) - { - if (!Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LivingShard"), Main.rand.Next(6, 10)); - } - } - else if (npc.type == NPCID.NebulaBrain || npc.type == NPCID.NebulaSoldier || npc.type == NPCID.NebulaHeadcrab || npc.type == NPCID.NebulaBeast) - { - if (Main.expertMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MeldBlob"), Main.rand.Next(2, 4)); - } - } - else if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MeldBlob"), (Main.rand.Next(1, 3))); - } - } - else if (npc.type == NPCID.CultistBoss) - { - if (!Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MeldBlob"), Main.rand.Next(20, 26)); - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StardustStaff")); - } - } - } - else if (npc.type == NPCID.EyeofCthulhu) - { - if (!Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(2, 5)); - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TeardropCleaver")); - } - } - } - else if (npc.type == NPCID.DevourerHead || npc.type == NPCID.SeekerHead) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FetidEssence")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FetidEssence")); - } - } - else if (npc.type == NPCID.FaceMonster || npc.type == NPCID.Herpling) - { - if (Main.expertMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodlettingEssence")); - } - } - else if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodlettingEssence")); - } - } - else if (npc.type == NPCID.ManEater) - { - if (Main.expertMode) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManeaterBulb")); - } - } - else if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManeaterBulb")); - } - } - else if (npc.type == NPCID.AngryTrapper) - { - if (Main.expertMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrapperBulb")); - } - } - else if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrapperBulb")); - } - } - else if (npc.type == NPCID.MotherSlime || npc.type == NPCID.Crimslime || npc.type == NPCID.CorruptSlime) - { - if (Main.expertMode) - { - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkySludge")); - } - } - else if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkySludge")); - } - } - else if (npc.type == NPCID.Moth) - { - if (Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GypsyPowder")); - } - else if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GypsyPowder")); - } - } - else if (npc.type == NPCID.Derpling) - { - if (Main.expertMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BeetleJuice")); - } - } - else if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BeetleJuice")); - } - } - else if (npc.type == NPCID.SpikedJungleSlime || npc.type == NPCID.Arapaima) - { - if (Main.expertMode) - { - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkyPaste")); - } - } - else if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkyPaste")); - } - } - #endregion - #region Boss Specials - if (npc.boss && !CalamityWorld.downedBossAny) - { - CalamityWorld.downedBossAny = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail || npc.type == NPCID.BrainofCthulhu) - { - if (npc.boss) - { - bool downedEvil = CalamityWorld.downedWhar; - CalamityWorld.downedWhar = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - if (!downedEvil) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); - if (WorldGen.crimson) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge8")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge11")); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge9")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge12")); - } - } - } - } - else if (npc.type == NPCID.SkeletronHead) - { - bool downedSkull = CalamityWorld.downedSkullHead; - CalamityWorld.downedSkullHead = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - if (!downedSkull) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 3); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge17")); - } - } - else if (npc.type == NPCID.WallofFlesh) - { - if (CalamityWorld.checkAstralMeteor()) - { - if (!CalamityWorld.spawnAstralMeteor) - { - string key = "Mods.CalamityMod.AstralText"; - Color messageColor = Color.Gold; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - CalamityWorld.spawnAstralMeteor = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - CalamityWorld.dropAstralMeteor(); - } - else if (Main.rand.Next(2) == 0 && !CalamityWorld.spawnAstralMeteor2) - { - string key = "Mods.CalamityMod.AstralText"; - Color messageColor = Color.Gold; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - CalamityWorld.spawnAstralMeteor2 = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - CalamityWorld.dropAstralMeteor(); - } - else if (Main.rand.Next(4) == 0 && !CalamityWorld.spawnAstralMeteor3) - { - string key = "Mods.CalamityMod.AstralText"; - Color messageColor = Color.Gold; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - CalamityWorld.spawnAstralMeteor3 = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - CalamityWorld.dropAstralMeteor(); - } - } - if (!Main.expertMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MLGRune")); - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Meowthrower")); - } - if (Main.rand.Next(8) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RogueEmblem")); - } - if (Main.rand.Next(5) == 0) - { - switch (Main.rand.Next(2)) - { - case 0: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimsonKey); - break; - case 1: - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CorruptionKey); - break; - } - } - } - bool hardMode = CalamityWorld.downedUgly; - CalamityWorld.downedUgly = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - string key2 = "Mods.CalamityMod.UglyBossText"; - Color messageColor2 = Color.Aquamarine; - if (!hardMode) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 3); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge7")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge18")); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - } - } - else if (npc.type == NPCID.SkeletronPrime || npc.type == mod.NPCType("BrimstoneElemental")) - { - bool downedPrime = CalamityWorld.downedSkeletor; - if (npc.type == NPCID.SkeletronPrime) - { - CalamityWorld.downedSkeletor = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - string key = "Mods.CalamityMod.SteelSkullBossText"; - Color messageColor = Color.Crimson; - if (!downedPrime && !CalamityWorld.downedBrimstoneElemental) - { - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - if (npc.type == mod.NPCType("BrimstoneElemental")) - { - if (!CalamityWorld.downedBrimstoneElemental) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge6")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge26")); - } - CalamityWorld.downedBrimstoneElemental = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else if (npc.type == NPCID.Plantera || npc.type == mod.NPCType("CalamitasRun3")) - { - bool downedPlant = CalamityWorld.downedPlantThing; - if (npc.type == NPCID.Plantera) - { - if (!Main.expertMode) - { - if (Main.rand.Next(5) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.JungleKey); - } - } - CalamityWorld.downedPlantThing = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - string key = "Mods.CalamityMod.PlantBossText"; - Color messageColor = Color.RoyalBlue; - string key2 = "Mods.CalamityMod.PlantOreText"; - Color messageColor2 = Color.GreenYellow; - if (npc.type == mod.NPCType("CalamitasRun3")) - { - if (!CalamityWorld.downedCalamitas && !downedPlant) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), - (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); - } - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - npc.DropItemInstanced(npc.position, npc.Size, ItemID.BrokenHeroSword, 1, true); - if (!CalamityWorld.downedCalamitas) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge24")); - } - CalamityWorld.downedCalamitas = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - if (npc.type == NPCID.Plantera) - { - if (!downedPlant) - { - CalamityWorld.spawnOre(mod.TileType("PerennialOre"), 12E-05, .5f, .7f); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - } - if (!downedPlant && !CalamityWorld.downedCalamitas) - { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), - (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); - } - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - } - else if (npc.type == NPCID.Golem) - { - bool downedIdiot = CalamityWorld.downedGolemBaby; - CalamityWorld.downedGolemBaby = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - string key = "Mods.CalamityMod.BabyBossText"; - Color messageColor = Color.Lime; - string key2 = "Mods.CalamityMod.BabyBossText2"; - Color messageColor2 = Color.Yellow; - if (!downedIdiot) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge31")); - npc.DropItemInstanced(npc.position, npc.Size, ItemID.Picksaw, 1, true); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - } - } - else if (npc.type == NPCID.MoonLordCore) - { - bool downedMoonDude = CalamityWorld.downedMoonDude; - CalamityWorld.downedMoonDude = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - string key = "Mods.CalamityMod.MoonBossText"; - Color messageColor = Color.Orange; - string key2 = "Mods.CalamityMod.MoonBossText2"; - Color messageColor2 = Color.Violet; - string key3 = "Mods.CalamityMod.MoonBossText3"; - Color messageColor3 = Color.Crimson; - string key4 = "Mods.CalamityMod.ProfanedBossText2"; - Color messageColor4 = Color.Cyan; - string key5 = "Mods.CalamityMod.FutureOreText"; - Color messageColor5 = Color.LightGray; - if (!downedMoonDude) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - CalamityWorld.spawnOre(mod.TileType("ExodiumOre"), 12E-05, .01f, .07f); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - Main.NewText(Language.GetTextValue(key2), messageColor2); - Main.NewText(Language.GetTextValue(key3), messageColor3); - Main.NewText(Language.GetTextValue(key4), messageColor4); - Main.NewText(Language.GetTextValue(key5), messageColor5); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key4), messageColor4); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key5), messageColor5); - } - } - } - else if (npc.type == NPCID.DD2Betsy) - { - if (!CalamityWorld.downedBetsy) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - } - CalamityWorld.downedBetsy = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == NPCID.Pumpking && CalamityWorld.downedDoG) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NightmareFuel"), Main.rand.Next(10, 21)); - } - else if (npc.type == NPCID.IceQueen && CalamityWorld.downedDoG) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EndothermicEnergy"), Main.rand.Next(20, 41)); - } - else if (npc.type == NPCID.Mothron && CalamityWorld.buffedEclipse) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DarksunFragment"), Main.rand.Next(10, 21)); - CalamityWorld.downedBuffedMothron = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("Astrageldon")) - { - if (CalamityWorld.checkAstralMeteor()) - { - string key = "Mods.CalamityMod.AstralText"; - Color messageColor = Color.Gold; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - CalamityWorld.dropAstralMeteor(); - } - if (!CalamityWorld.downedAstrageldon) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge30")); - } - CalamityWorld.downedAstrageldon = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("HiveMindP2")) //boss 2 - { - if (!CalamityWorld.downedHiveMind) - { - if (!CalamityWorld.downedPerforator) - { - string key = "Mods.CalamityMod.SkyOreText"; - Color messageColor = Color.Cyan; - CalamityWorld.spawnOre(mod.TileType("AerialiteOre"), 12E-05, .4f, .6f); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge14")); - } - CalamityWorld.downedHiveMind = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("PerforatorHive")) //boss 3 - { - if (!CalamityWorld.downedPerforator) - { - if (!CalamityWorld.downedHiveMind) - { - string key = "Mods.CalamityMod.SkyOreText"; - Color messageColor = Color.Cyan; - CalamityWorld.spawnOre(mod.TileType("AerialiteOre"), 12E-05, .4f, .6f); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge13")); - } - CalamityWorld.downedPerforator = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("SlimeGodCore") || npc.type == mod.NPCType("SlimeGodSplit") || npc.type == mod.NPCType("SlimeGodRunSplit")) //boss 4 - { - if (npc.type == mod.NPCType("SlimeGodCore") && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) - && !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) - { - if (!CalamityWorld.downedSlimeGod) - { - if (revenge && !Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("PurifiedJam"), Main.rand.Next(6, 9), true); - Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop = true; - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 3); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge15")); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaticRefiner")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurifiedGel"), Main.rand.Next(25, 41)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(180, 251)); - int maskChoice = Main.rand.Next(2); - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OverloadedBlaster")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GelDart"), Main.rand.Next(80, 101)); - } - if (Main.rand.Next(7) == 0) - { - if (maskChoice == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask")); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask2")); - } - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AbyssalTome")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EldritchTome")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrimslimeStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CorroslimeStaff")); - } - } - CalamityWorld.downedSlimeGod = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("SlimeGodSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) && - NPC.CountNPCS(mod.NPCType("SlimeGodSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) - { - if (!CalamityWorld.downedSlimeGod) - { - if (revenge && !Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("PurifiedJam"), Main.rand.Next(6, 9), true); - Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop = true; - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 3); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge15")); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaticRefiner")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurifiedGel"), Main.rand.Next(25, 41)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(180, 251)); - int maskChoice = Main.rand.Next(2); - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OverloadedBlaster")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GelDart"), Main.rand.Next(80, 101)); - } - if (Main.rand.Next(7) == 0) - { - if (maskChoice == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask")); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask2")); - } - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AbyssalTome")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EldritchTome")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrimslimeStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CorroslimeStaff")); - } - } - CalamityWorld.downedSlimeGod = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("SlimeGodRunSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && - NPC.CountNPCS(mod.NPCType("SlimeGodRunSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGod"))) - { - if (!CalamityWorld.downedSlimeGod) - { - if (revenge && !Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop) - { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("PurifiedJam"), Main.rand.Next(6, 9), true); - Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop = true; - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 3); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge15")); - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodTrophy")); - } - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaticRefiner")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurifiedGel"), Main.rand.Next(25, 41)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(180, 251)); - int maskChoice = Main.rand.Next(2); - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OverloadedBlaster")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GelDart"), Main.rand.Next(80, 101)); - } - if (Main.rand.Next(7) == 0) - { - if (maskChoice == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask")); - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask2")); - } - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AbyssalTome")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EldritchTome")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrimslimeStaff")); - } - if (Main.rand.Next(4) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CorroslimeStaff")); - } - } - CalamityWorld.downedSlimeGod = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else if (npc.type == mod.NPCType("Cryogen")) //boss 5 - { - if (!CalamityWorld.downedCryogen) - { - string key = "Mods.CalamityMod.IceOreText"; - Color messageColor = Color.LightSkyBlue; - CalamityWorld.spawnOre(mod.TileType("CryonicOre"), 15E-05, .45f, .65f); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge19")); - } - CalamityWorld.downedCryogen = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("Leviathan")) //boss 8 - { - int bossType = (npc.type == mod.NPCType("Siren")) ? mod.NPCType("Leviathan") : mod.NPCType("Siren"); - if (!NPC.AnyNPCs(bossType)) - { - if (!CalamityWorld.downedLeviathan) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge10")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge28")); - } - CalamityWorld.downedLeviathan = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - } - else if (npc.type == mod.NPCType("PlaguebringerGoliath")) //boss 9 - { - if (!CalamityWorld.downedPlaguebringer) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge32")); - } - CalamityWorld.downedPlaguebringer = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("ProfanedGuardianBoss")) //boss 10 - { - if (!CalamityWorld.downedGuardians) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - } - CalamityWorld.downedGuardians = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("Providence")) //boss 11 - { - string key2 = "Mods.CalamityMod.ProfanedBossText3"; - Color messageColor2 = Color.Orange; - string key3 = "Mods.CalamityMod.TreeOreText"; - Color messageColor3 = Color.LightGreen; - if (!CalamityWorld.downedProvidence) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - CalamityWorld.spawnOre(mod.TileType("UelibloomOre"), 15E-05, .4f, .8f); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - Main.NewText(Language.GetTextValue(key3), messageColor3); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); - } - } - CalamityWorld.downedProvidence = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("CeaselessVoid")) //boss 12 - { - if (!CalamityWorld.downedSentinel1) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - } - CalamityWorld.downedSentinel1 = true; //21600 - if (CalamityWorld.DoGSecondStageCountdown > 14460) - { - CalamityWorld.DoGSecondStageCountdown = 14460; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - } - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("StormWeaverHeadNaked")) //boss 13 - { - if (!CalamityWorld.downedSentinel2) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - } - CalamityWorld.downedSentinel2 = true; //21600 - if (CalamityWorld.DoGSecondStageCountdown > 7260) - { - CalamityWorld.DoGSecondStageCountdown = 7260; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - } - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("CosmicWraith")) //boss 14 - { - if (!CalamityWorld.downedSentinel3) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - } - CalamityWorld.downedSentinel3 = true; //21600 - if (CalamityWorld.DoGSecondStageCountdown > 600) - { - CalamityWorld.DoGSecondStageCountdown = 600; - if (Main.netMode == 2) - { - var netMessage = mod.GetPacket(); - netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); - netMessage.Write(CalamityWorld.DoGSecondStageCountdown); - netMessage.Send(); - } - } - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("Bumblefuck")) //boss 16 - { - if (!CalamityWorld.downedBumble) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - } - CalamityWorld.downedBumble = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("Yharon")) //boss 17 - { - string key = "Mods.CalamityMod.DargonBossText"; - Color messageColor = Color.Orange; - string key2 = "Mods.CalamityMod.AuricOreText"; - Color messageColor2 = Color.Gold; - if (!CalamityWorld.downedYharon && npc.localAI[2] == 1f) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 6); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 3); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells"), 2); - CalamityWorld.spawnOre(mod.TileType("AuricOre"), 2E-05, .6f, .8f); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key2), messageColor2); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); - } - } - if (npc.localAI[2] == 1f) - { - CalamityWorld.downedYharon = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - if (!CalamityWorld.buffedEclipse && npc.localAI[2] != 2f) - { - CalamityWorld.buffedEclipse = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - } - else if (npc.type == mod.NPCType("SupremeCalamitas")) //boss 18 - { - if (!CalamityWorld.downedSCal) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 6); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 3); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells"), 2); - } - CalamityWorld.downedSCal = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("CrabulonIdle")) //boss 19 - { - if (!CalamityWorld.downedCrabulon) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge5")); - } - CalamityWorld.downedCrabulon = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("ScavengerBody")) //boss 20 - { - if (!CalamityWorld.downedScavenger) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Knowledge33")); - } - CalamityWorld.downedScavenger = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("Polterghast")) //boss 21 - { - string key = "Mods.CalamityMod.GhostBossText"; - Color messageColor = Color.RoyalBlue; - if (!CalamityWorld.downedPolterghast) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 6); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 3); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells"), 2); - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - } - CalamityWorld.downedPolterghast = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("THELORDE")) //boss 22 - { - CalamityWorld.downedLORDE = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - else if (npc.type == mod.NPCType("GiantClam")) //boss 23 - { - CalamityWorld.downedCLAM = true; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - /*else if (npc.type == mod.NPCType("OldDuke")) //boss 23 - { - CalamityWorld.downedOldDuke = true; - }*/ - if (CalamityWorld.death) - { - if (npc.type == mod.NPCType("SupremeCalamitas")) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Levi")); - } - } - #endregion } #endregion @@ -11554,7 +8361,7 @@ namespace CalamityMod.NPCs spawnRate = (int)((double)spawnRate * (player.GetModPlayer(mod).ZoneAbyss ? 1.75 : 75)); maxSpawns = (int)((float)maxSpawns * (player.GetModPlayer(mod).ZoneAbyss ? 0.625f : 0.005f)); } - else if (CalamityPlayer.areThereAnyDamnBosses || player.GetModPlayer(mod).zen || (Config.DisableExpertEnemySpawnsNearHouse && player.townNPCs > 1f)) + else if (CalamityPlayer.areThereAnyDamnBosses || player.GetModPlayer(mod).zen || (Config.DisableExpertEnemySpawnsNearHouse && player.townNPCs > 1f && Main.expertMode)) { spawnRate = (int)((double)spawnRate * (player.GetModPlayer(mod).ZoneAbyss ? 1.5 : 50)); maxSpawns = (int)((float)maxSpawns * (player.GetModPlayer(mod).ZoneAbyss ? 0.75f : 0.01f)); @@ -11595,6 +8402,22 @@ namespace CalamityMod.NPCs #region Drawing public override void DrawEffects(NPC npc, ref Color drawColor) { + if (bBlood) + { + if (Main.rand.Next(5) < 4) + { + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 5, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default(Color), 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity.Y -= 0.5f; + if (Main.rand.Next(4) == 0) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + Lighting.AddLight(npc.position, 0.08f, 0f, 0f); + } if (bFlames || enraged) { if (Main.rand.Next(5) < 4) @@ -11760,7 +8583,7 @@ namespace CalamityMod.NPCs { if (Main.player[Main.myPlayer].GetModPlayer(mod).trippy) return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, npc.alpha); - if (enraged) + if (enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) return new Color(200, 50, 50, npc.alpha); return null; } @@ -11857,6 +8680,8 @@ namespace CalamityMod.NPCs string worldEvil = WorldGen.crimson ? "Crimson" : "Corruption"; if (Main.rand.Next(15) == 0 && fapsol2 != -1) chat = "Sometimes I catch " + Main.npc[fapsol2].GivenName + " sneaking up from behind me."; + if (Main.rand.Next(15) == 0 && fapsol2 != -1) + chat = Main.npc[fapsol2].GivenName + " is always trying to brighten my mood...even if, deep down, I know she's sad."; if (Main.rand.Next(15) == 0 && CalamityWorld.spawnAstralMeteor) chat = "Please don't catch space lice. Or " + worldEvil + " lice. Or just lice in general."; break; @@ -12039,24 +8864,6 @@ namespace CalamityMod.NPCs nextSlot++; } } - if (Main.hardMode) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("MagnumRounds")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(12, 50, 0, 0); - nextSlot++; - } - if (NPC.downedPlantBoss) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("GrenadeRounds")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(25, 0, 0, 0); - nextSlot++; - } - if (NPC.downedMoonlord) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("ExplosiveShells")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(50, 0, 0, 0); - nextSlot++; - } } if (type == NPCID.Dryad) { @@ -12168,6 +8975,8 @@ namespace CalamityMod.NPCs shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); nextSlot++; } + shop.item[nextSlot].SetDefaults(mod.ItemType("RomajedaOrchid")); + nextSlot++; } if (type == NPCID.GoblinTinkerer) { @@ -12258,12 +9067,6 @@ namespace CalamityMod.NPCs shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); nextSlot++; } - if (CalamityWorld.downedCalamitas) - { - shop.item[nextSlot].SetDefaults(mod.ItemType("BlightedEyeball")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 20, 0, 0); - nextSlot++; - } if (CalamityWorld.downedAstrageldon) { shop.item[nextSlot].SetDefaults(mod.ItemType("AstralChunk")); @@ -12272,9 +9075,6 @@ namespace CalamityMod.NPCs } if (CalamityWorld.downedStarGod) { - shop.item[nextSlot].SetDefaults(mod.ItemType("Starcore")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 30, 0, 0); - nextSlot++; shop.item[nextSlot].SetDefaults(ItemID.SpectreStaff); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(0, 25, 0, 0); nextSlot++; @@ -12333,7 +9133,7 @@ namespace CalamityMod.NPCs if (CalamityWorld.downedBumble) { shop.item[nextSlot].SetDefaults(mod.ItemType("BirbPheromones")); - shop.item[nextSlot].shopCustomPrice = Item.buyPrice(20, 0, 0, 0); + shop.item[nextSlot].shopCustomPrice = Item.buyPrice(5, 0, 0, 0); nextSlot++; } } @@ -12351,7 +9151,8 @@ namespace CalamityMod.NPCs Mod mod = ModLoader.GetMod("CalamityMod"); for (int i = 0; i < 200; i++) { - if (Main.npc[i].active && (Main.npc[i].boss || Main.npc[i].type == NPCID.EaterofWorldsHead || Main.npc[i].type == NPCID.EaterofWorldsTail || Main.npc[i].type == mod.NPCType("SlimeGodRun") || + if (Main.npc[i].active && Main.npc[i].type != NPCID.MartianSaucerCore && + (Main.npc[i].boss || Main.npc[i].type == NPCID.EaterofWorldsHead || Main.npc[i].type == NPCID.EaterofWorldsTail || Main.npc[i].type == mod.NPCType("SlimeGodRun") || Main.npc[i].type == mod.NPCType("SlimeGodRunSplit") || Main.npc[i].type == mod.NPCType("SlimeGod") || Main.npc[i].type == mod.NPCType("SlimeGodSplit"))) { return true; @@ -12415,22 +9216,6 @@ namespace CalamityMod.NPCs } #endregion - #region DespawnHostileProjectiles - public void DespawnProj() - { - int proj; - for (int x = 0; x < 1000; x = proj + 1) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active && projectile.hostile && !projectile.friendly && projectile.damage > 0) - { - projectile.Kill(); - } - proj = x; - } - } - #endregion - #region Astral things public static void DoHitDust(NPC npc, int hitDirection, int dustType = 5, float xSpeedMult = 1f, int numHitDust = 5, int numDeathDust = 20) { diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs new file mode 100644 index 0000000000..aea8c7628a --- /dev/null +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -0,0 +1,3656 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.Achievements; +using Terraria.GameContent.Events; +using Terraria.GameContent.Tile_Entities; +using Terraria.GameContent.UI; +using Terraria.ID; +using Terraria.World.Generation; +using Terraria.GameContent.Generation; +using CalamityMod.Tiles; +using CalamityMod.Projectiles; +using CalamityMod; +using CalamityMod.Items; +using CalamityMod.World; + +namespace CalamityMod.NPCs +{ + public class CalamityGlobalNPCLoot : GlobalNPC + { + #region PreNPCLoot + public override bool PreNPCLoot(NPC npc) + { + #region BossRush + if (CalamityWorld.bossRushActive) + { + if (npc.type == mod.NPCType("ProfanedGuardianBoss")) + { + CalamityWorld.bossRushStage = 7; + DespawnProj(); + } + else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) + { + if (npc.boss) + { + CalamityWorld.bossRushStage = 8; + DespawnProj(); + } + } + else if (npc.type == mod.NPCType("Astrageldon")) + { + CalamityWorld.bossRushStage = 9; + DespawnProj(); + } + else if (npc.type == mod.NPCType("Bumblefuck")) + { + CalamityWorld.bossRushStage = 12; + DespawnProj(); + } + else if (npc.type == mod.NPCType("HiveMindP2")) + { + CalamityWorld.bossRushStage = 14; + DespawnProj(); + } + else if (npc.type == mod.NPCType("StormWeaverHeadNaked")) + { + CalamityWorld.bossRushStage = 16; + DespawnProj(); + } + else if (npc.type == mod.NPCType("AquaticScourgeHead")) + { + CalamityWorld.bossRushStage = 17; + DespawnProj(); + } + else if (npc.type == mod.NPCType("DesertScourgeHead")) + { + CalamityWorld.bossRushStage = 18; + DespawnProj(); + } + else if (npc.type == mod.NPCType("CrabulonIdle")) + { + CalamityWorld.bossRushStage = 20; + DespawnProj(); + } + else if (npc.type == mod.NPCType("CeaselessVoid")) + { + CalamityWorld.bossRushStage = 22; + DespawnProj(); + } + else if (npc.type == mod.NPCType("PerforatorHive")) + { + CalamityWorld.bossRushStage = 23; + DespawnProj(); + } + else if (npc.type == mod.NPCType("Cryogen")) + { + CalamityWorld.bossRushStage = 24; + DespawnProj(); + } + else if (npc.type == mod.NPCType("BrimstoneElemental")) + { + CalamityWorld.bossRushStage = 25; + DespawnProj(); + } + else if (npc.type == mod.NPCType("CosmicWraith")) + { + CalamityWorld.bossRushStage = 26; + DespawnProj(); + string key = "Mods.CalamityMod.BossRushTierThreeEndText"; + Color messageColor = Color.LightCoral; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else if (npc.type == mod.NPCType("ScavengerBody")) + { + CalamityWorld.bossRushStage = 27; + DespawnProj(); + } + else if (npc.type == mod.NPCType("AstrumDeusHeadSpectral")) + { + CalamityWorld.bossRushStage = 30; + DespawnProj(); + } + else if (npc.type == mod.NPCType("Polterghast")) + { + CalamityWorld.bossRushStage = 31; + DespawnProj(); + } + else if (npc.type == mod.NPCType("PlaguebringerGoliath")) + { + CalamityWorld.bossRushStage = 32; + DespawnProj(); + } + else if (npc.type == mod.NPCType("CalamitasRun3")) + { + CalamityWorld.bossRushStage = 33; + DespawnProj(); + string key = "Mods.CalamityMod.BossRushTierFourEndText"; + Color messageColor = Color.LightCoral; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + else if (npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("Leviathan")) + { + int bossType = (npc.type == mod.NPCType("Siren")) ? mod.NPCType("Leviathan") : mod.NPCType("Siren"); + if (!NPC.AnyNPCs(bossType)) + { + CalamityWorld.bossRushStage = 34; + DespawnProj(); + } + } + else if (npc.type == mod.NPCType("SlimeGodCore") || npc.type == mod.NPCType("SlimeGodSplit") || npc.type == mod.NPCType("SlimeGodRunSplit")) + { + if (npc.type == mod.NPCType("SlimeGodCore") && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) && + !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) + { + CalamityWorld.bossRushStage = 35; + DespawnProj(); + } + else if (npc.type == mod.NPCType("SlimeGodSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) && + NPC.CountNPCS(mod.NPCType("SlimeGodSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) + { + CalamityWorld.bossRushStage = 35; + DespawnProj(); + } + else if (npc.type == mod.NPCType("SlimeGodRunSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && + NPC.CountNPCS(mod.NPCType("SlimeGodRunSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGod"))) + { + CalamityWorld.bossRushStage = 35; + DespawnProj(); + } + } + else if (npc.type == mod.NPCType("Providence")) + { + CalamityWorld.bossRushStage = 36; + DespawnProj(); + } + else if (npc.type == mod.NPCType("SupremeCalamitas")) + { + CalamityWorld.bossRushStage = 37; + DespawnProj(); + } + else if (npc.type == mod.NPCType("Yharon")) + { + CalamityWorld.bossRushStage = 38; + DespawnProj(); + } + else if (npc.type == mod.NPCType("DevourerofGodsHeadS")) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Rock"), 1, true); + CalamityWorld.bossRushStage = 0; + DespawnProj(); + CalamityWorld.bossRushActive = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStage); + netMessage.Write(CalamityWorld.bossRushStage); + netMessage.Send(); + } + string key = "Mods.CalamityMod.BossRushTierFiveEndText"; + Color messageColor = Color.LightCoral; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + return false; + } + switch (npc.type) + { + case NPCID.QueenBee: + CalamityWorld.bossRushStage = 1; + DespawnProj(); + break; + case NPCID.BrainofCthulhu: + CalamityWorld.bossRushStage = 2; + DespawnProj(); + break; + case NPCID.KingSlime: + CalamityWorld.bossRushStage = 3; + DespawnProj(); + break; + case NPCID.EyeofCthulhu: + CalamityWorld.bossRushStage = 4; + DespawnProj(); + break; + case NPCID.SkeletronPrime: + CalamityWorld.bossRushStage = 5; + DespawnProj(); + break; + case NPCID.Golem: + CalamityWorld.bossRushStage = 6; + DespawnProj(); + break; + case NPCID.TheDestroyer: + CalamityWorld.bossRushStage = 10; + DespawnProj(); + string key = "Mods.CalamityMod.BossRushTierOneEndText"; + Color messageColor = Color.LightCoral; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + break; + case NPCID.Spazmatism: + CalamityWorld.bossRushStage = 11; + DespawnProj(); + break; + case NPCID.Retinazer: + CalamityWorld.bossRushStage = 11; + DespawnProj(); + break; + case NPCID.WallofFlesh: + CalamityWorld.bossRushStage = 13; + DespawnProj(); + break; + case NPCID.SkeletronHead: + CalamityWorld.bossRushStage = 15; + DespawnProj(); + break; + case NPCID.CultistBoss: + CalamityWorld.bossRushStage = 19; + DespawnProj(); + string key2 = "Mods.CalamityMod.BossRushTierTwoEndText"; + Color messageColor2 = Color.LightCoral; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + } + break; + case NPCID.Plantera: + CalamityWorld.bossRushStage = 21; + DespawnProj(); + break; + case NPCID.DukeFishron: + CalamityWorld.bossRushStage = 28; + DespawnProj(); + break; + case NPCID.MoonLordCore: + CalamityWorld.bossRushStage = 29; + DespawnProj(); + break; + default: + break; + } + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.BossRushStage); + netMessage.Write(CalamityWorld.bossRushStage); + netMessage.Send(); + } + return false; + } + #endregion + #region AbyssDropCancel + int x = Main.maxTilesX; + int y = Main.maxTilesY; + int genLimit = x / 2; + int abyssChasmY = y - 250; + int abyssChasmX = (CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135)); + bool abyssPosX = false; + bool abyssPosY = ((double)(npc.position.Y / 16f) <= abyssChasmY); + if (CalamityWorld.abyssSide) + { + if ((double)(npc.position.X / 16f) < abyssChasmX + 80) + { + abyssPosX = true; + } + } + else + { + if ((double)(npc.position.X / 16f) > abyssChasmX - 80) + { + abyssPosX = true; + } + } + bool hurtByAbyss = (npc.wet && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && + ((((double)(npc.position.Y / 16f) > (Main.rockLayer - (double)Main.maxTilesY * 0.05)) && + abyssPosY && abyssPosX) || CalamityWorld.abyssTiles > 200) && + !npc.buffImmune[mod.BuffType("CrushDepth")]); + if (hurtByAbyss) + { + return false; + } + #endregion + if (CalamityWorld.revenge) + { + if (npc.type == NPCID.Probe) + return false; + } + if (!NPC.downedMechBossAny && (npc.type == NPCID.Spazmatism || npc.type == NPCID.TheDestroyer || npc.type == NPCID.SkeletronPrime)) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge20"), 1, true); + } + if (!NPC.downedSlimeKing && npc.type == NPCID.KingSlime) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); + } + else if (!NPC.downedBoss1 && npc.type == NPCID.EyeofCthulhu) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge3"), 1, true); + } + else if (!NPC.downedQueenBee && npc.type == NPCID.QueenBee) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge16"), 1, true); + } + else if (!NPC.downedMechBoss1 && npc.type == NPCID.TheDestroyer) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge21"), 1, true); + } + else if (!NPC.downedMechBoss2 && npc.type == NPCID.Spazmatism) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge22"), 1, true); + } + else if (!NPC.downedMechBoss3 && npc.type == NPCID.SkeletronPrime) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge23"), 1, true); + } + else if (!NPC.downedPlantBoss && npc.type == NPCID.Plantera) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge25"), 1, true); + } + else if (!NPC.downedFishron && npc.type == NPCID.DukeFishron) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge2"), 1, true); + } + else if (npc.type == NPCID.CultistBoss) + { + if (!NPC.downedAncientCultist) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge4"), 1, true); + } + if (Main.bloodMoon) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge34"), 1, true); + } + } + return true; + } + #endregion + + #region NPCLoot + public override void NPCLoot(NPC npc) + { + bool revenge = CalamityWorld.revenge; + if (CalamityGlobalNPC.DraedonMayhem) + { + if (!CalamityPlayer.areThereAnyDamnBosses) + { + CalamityGlobalNPC.DraedonMayhem = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + } + #region RareVariants + if (npc.type == NPCID.BloodZombie && NPC.downedBoss3) + { + if (Main.rand.Next(200) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Carnage")); + } + } + else if (npc.type == NPCID.TacticalSkeleton) + { + if (Main.rand.Next(200) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrueConferenceCall")); + } + } + else if (npc.type == NPCID.DesertBeast) + { + if (Main.rand.Next(200) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EvilSmasher")); + } + } + else if (npc.type == NPCID.DungeonSpirit) + { + if (Main.rand.Next(200) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PearlGod")); + } + } + else if (npc.type == NPCID.RuneWizard) + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EyeofMagnus")); + } + } + else if (npc.type == NPCID.Mimic) + { + if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheBee")); + } + } + #endregion + #region DefiledLoot + if (CalamityWorld.defiled) + { + if (npc.type == NPCID.AnglerFish || npc.type == NPCID.Werewolf) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AdhesiveBandage); + } + if (npc.type == NPCID.Werewolf) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MoonCharm); + } + } + } + else if (npc.type == NPCID.DesertBeast) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AncientHorn); + } + } + else if (npc.type == NPCID.ArmoredSkeleton) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BeamSword); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ArmorPolish); + } + } + else if (npc.type == NPCID.Clown) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bananarang); + } + } + else if (npc.type == NPCID.Hornet || npc.type == NPCID.MossHornet || npc.type == NPCID.ToxicSludge) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Bezoar); + } + if (npc.type == NPCID.MossHornet) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TatteredBeeWing); + } + } + } + else if (npc.type == NPCID.EyeofCthulhu) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Binoculars); + } + } + else if (npc.type == NPCID.DemonEye || npc.type == NPCID.WanderingEye) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlackLens); + } + } + else if (npc.type == NPCID.CorruptSlime || npc.type == NPCID.DarkMummy) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Blindfold); + } + } + else if (npc.type >= 269 && npc.type <= 280) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Keybrand); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BoneFeather); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MagnetSphere); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WispinaBottle); + } + } + else if (npc.type == NPCID.UndeadMiner) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BonePickaxe); + } + } + else if (npc.type == NPCID.Skeleton) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BoneSword); + } + } + else if (npc.type == NPCID.ScutlixRider) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BrainScrambler); + } + } + else if (npc.type == NPCID.Vampire) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BrokenBatWing); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MoonStone); + } + } + else if (npc.type == NPCID.CaveBat) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ChainKnife); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DepthMeter); + } + } + else if (npc.type == NPCID.DarkCaster || npc.type == NPCID.AngryBones) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ClothierVoodooDoll); + } + } + else if (npc.type == NPCID.PirateCaptain) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CoinGun); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DiscountCard); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Cutlass); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.LuckyCoin); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.PirateStaff); + } + } + else if (npc.type == NPCID.Reaper) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DeathSickle); + } + } + else if (npc.type == NPCID.Demon) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DemonScythe); + } + } + else if (npc.type == NPCID.DesertDjinn) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DjinnLamp); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DjinnsCurse); + } + } + else if (npc.type == NPCID.Shark) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.DivingHelmet); + } + } + else if (npc.type == NPCID.Pixie || npc.type == NPCID.Wraith || npc.type == NPCID.Mummy) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FastClock); + } + } + else if (npc.type == NPCID.RedDevil) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FireFeather); + } + } + else if (npc.type == NPCID.IceElemental || npc.type == NPCID.IcyMerman || npc.type == NPCID.ArmoredViking || npc.type == NPCID.IceTortoise) + { + if (npc.type == NPCID.IceElemental || npc.type == NPCID.IcyMerman) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FrostStaff); + } + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.IceSickle); + } + if (npc.type == NPCID.IceTortoise) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FrozenTurtleShell); + } + } + } + else if (npc.type == NPCID.Harpy && Main.hardMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GiantHarpyFeather); + } + } + else if (npc.type == mod.NPCType("SunBat")) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HelFire); + } + } + else if (npc.type == mod.NPCType("Cryon")) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Amarok); + } + } + else if (npc.type == NPCID.QueenBee) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HoneyedGoggles); + } + } + else if (npc.type == NPCID.Piranha) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Hook); + } + } + else if (npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.InfernoFork); + } + } + else if (npc.type == NPCID.PinkJellyfish) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.JellyfishNecklace); + } + } + else if (npc.type == NPCID.Paladin) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Kraken); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.PaladinsHammer); + } + } + else if (npc.type == NPCID.SkeletonArcher) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MagicQuiver); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Marrow); + } + } + else if (npc.type == NPCID.Lavabat) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.MagmaStone); + } + } + else if (npc.type == NPCID.WalkingAntlion) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AntlionClaw); + } + } + else if (npc.type == NPCID.DarkMummy || npc.type == NPCID.GreenJellyfish) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Megaphone); + } + } + else if (npc.type == NPCID.CursedSkull) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Nazar); + } + } + else if (npc.type == NPCID.FireImp) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ObsidianRose); + } + } + else if (npc.type == NPCID.BlackRecluse || npc.type == NPCID.BlackRecluseWall) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.PoisonStaff); + } + } + else if (npc.type == NPCID.SkeletonSniper) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.RifleScope); + } + } + else if (npc.type == NPCID.ChaosElemental) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.RodofDiscord); + } + } + else if (npc.type == NPCID.Necromancer || npc.type == NPCID.NecromancerArmored) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.ShadowbeamStaff); + } + } + else if (npc.type == NPCID.SnowFlinx) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SnowballLauncher); + } + } + else if (npc.type == NPCID.RaggedCaster) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SpectreStaff); + } + } + else if (npc.type == NPCID.Plantera) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TheAxe); + } + } + else if (npc.type == NPCID.GiantBat) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TrifoldMap); + } + } + else if (npc.type == NPCID.AngryTrapper) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Uzi); + } + } + else if (npc.type == NPCID.FloatyGross || npc.type == NPCID.Corruptor) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Vitamins); + } + } + else if (NPC.downedMechBossAny && npc.type == NPCID.GiantTortoise) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Yelets); + } + } + } + #endregion + #region ArmageddonLoot + if (CalamityWorld.armageddon) + { + int dropAmt = 5; + if (npc.type == NPCID.Golem) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.DukeFishron) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.DD2Betsy) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.EyeofCthulhu) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.BrainofCthulhu) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) + { + if (npc.boss) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + } + else if (npc.type == NPCID.QueenBee) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.SkeletronHead) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.WallofFlesh) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.MoonLordCore) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.KingSlime) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism) + { + int num64 = NPCID.Retinazer; + if (npc.type == NPCID.Retinazer) + { + num64 = NPCID.Spazmatism; + } + if (!NPC.AnyNPCs(num64)) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + } + else if (npc.type == NPCID.SkeletronPrime) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.TheDestroyer) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + else if (npc.type == NPCID.Plantera) + { + for (int i = 0; i < dropAmt; i++) + { + npc.DropBossBags(); + } + } + } + #endregion + #region AdrenalineReset + if (npc.boss && CalamityWorld.revenge) + { + if (npc.type != mod.NPCType("HiveMind") && npc.type != mod.NPCType("Leviathan") && npc.type != mod.NPCType("Siren") && + npc.type != mod.NPCType("StormWeaverHead") && npc.type != mod.NPCType("StormWeaverBody") && + npc.type != mod.NPCType("StormWeaverTail") && npc.type != mod.NPCType("DevourerofGodsHead") && + npc.type != mod.NPCType("DevourerofGodsBody") && npc.type != mod.NPCType("DevourerofGodsTail")) + { + if (Main.netMode != 2) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + { + Main.player[Main.myPlayer].GetModPlayer(mod).adrenaline = 0; + } + } + } + } + #endregion + #region SpawnPolterghast + if ((npc.type == mod.NPCType("PhantomSpirit") || npc.type == mod.NPCType("PhantomSpiritS") || npc.type == mod.NPCType("PhantomSpiritM") || + npc.type == mod.NPCType("PhantomSpiritL")) && !NPC.AnyNPCs(mod.NPCType("Polterghast")) && !CalamityWorld.downedPolterghast) + { + CalamityMod.ghostKillCount++; + if (CalamityMod.ghostKillCount >= 30 && Main.netMode != 1) + { + int lastPlayer = npc.lastInteraction; + if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) + { + lastPlayer = npc.FindClosestPlayer(); + } + if (lastPlayer >= 0) + { + NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("Polterghast")); + CalamityMod.ghostKillCount = 0; + } + } + } + #endregion + #region SpawnGSS + if ((NPC.downedPlantBoss || CalamityWorld.downedCalamitas) && npc.type == NPCID.SandShark && !NPC.AnyNPCs(mod.NPCType("GreatSandShark"))) + { + CalamityMod.sharkKillCount++; + if (CalamityMod.sharkKillCount >= 10 && Main.netMode != 1) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MaulerRoar"), + (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + } + int lastPlayer = npc.lastInteraction; + if (!Main.player[lastPlayer].active || Main.player[lastPlayer].dead) + { + lastPlayer = npc.FindClosestPlayer(); + } + if (lastPlayer >= 0) + { + NPC.SpawnOnPlayer(lastPlayer, mod.NPCType("GreatSandShark")); + CalamityMod.sharkKillCount = -10; + } + } + } + #endregion + #region WormLootFromNearestSegment + if (npc.type == mod.NPCType("DesertScourgeHead")) + { + Vector2 center = Main.player[npc.target].Center; + float num2 = 1E+08f; + Vector2 position2 = npc.position; + for (int k = 0; k < 200; k++) + { + if (Main.npc[k].active && (Main.npc[k].type == mod.NPCType("DesertScourgeHead") || Main.npc[k].type == mod.NPCType("DesertScourgeBody") || Main.npc[k].type == mod.NPCType("DesertScourgeTail"))) + { + float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); + if (num3 < num2) + { + num2 = num3; + position2 = Main.npc[k].position; + } + } + } + npc.position = position2; + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.LesserHealingPotion, Main.rand.Next(8, 15)); + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertScourgeTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(7, 15)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(5, 10)); + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeaboundStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Barinade")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StormSpray")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AquaticDischarge")); + } + if (Main.rand.Next(4) == 0) + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DuneHopper")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ScourgeoftheDesert")); + } + } + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DeepDiver")); + } + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertScourgeMask")); + } + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HighTestFishingLine); + } + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerTackleBag); + } + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TackleBox); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerEarring); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishermansGuide); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WeatherRadio); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sextant); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerHat); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerVest); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerPants); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CratePotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishingPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SonarPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(10) == 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AeroStone"), 1, true); + } + if (NPC.downedBoss3) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldenBugNet); + } + } + } + if (!CalamityWorld.downedDesertScourge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge"), 1, true); + } + string key = "Mods.CalamityMod.OpenSunkenSea"; + Color messageColor = Color.Aquamarine; + if (!CalamityWorld.downedDesertScourge) + { + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + CalamityWorld.downedDesertScourge = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("AquaticScourgeHead")) + { + Vector2 center = Main.player[npc.target].Center; + float num2 = 1E+08f; + Vector2 position2 = npc.position; + for (int k = 0; k < 200; k++) + { + if (Main.npc[k].active && + (Main.npc[k].type == mod.NPCType("AquaticScourgeHead") || + Main.npc[k].type == mod.NPCType("AquaticScourgeBody") || + Main.npc[k].type == mod.NPCType("AquaticScourgeBodyAlt") || + Main.npc[k].type == mod.NPCType("AquaticScourgeTail"))) + { + float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); + if (num3 < num2) + { + num2 = num3; + position2 = Main.npc[k].position; + } + } + } + npc.position = position2; + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GreaterHealingPotion, Main.rand.Next(8, 15)); + if (Main.hardMode) + { + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(11, 21)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SoulofSight, Main.rand.Next(20, 41)); + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DeepseaStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Barinautical")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Downpour")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SubmarineShocker")); + } + if (Main.rand.Next(8) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HighTestFishingLine); + } + if (Main.rand.Next(8) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerTackleBag); + } + if (Main.rand.Next(8) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TackleBox); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerEarring); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishermansGuide); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WeatherRadio); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sextant); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerHat); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerVest); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerPants); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CratePotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishingPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SonarPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AeroStone"), 1, true); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldenBugNet); + } + } + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(11, 21)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Coral, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Seashell, Main.rand.Next(5, 10)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Starfish, Main.rand.Next(5, 10)); + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HighTestFishingLine); + } + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerTackleBag); + } + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.TackleBox); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerEarring); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishermansGuide); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.WeatherRadio); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Sextant); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerHat); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerVest); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnglerPants); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CratePotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.FishingPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SonarPotion, Main.rand.Next(2, 4)); + } + if (Main.rand.Next(10) == 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AeroStone"), 1, true); + } + if (NPC.downedBoss3) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GoldenBugNet); + } + } + } + if (!CalamityWorld.downedAquaticScourge) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge27"), 1, true); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge35"), 1, true); + } + CalamityWorld.downedAquaticScourge = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("AstrumDeusHeadSpectral")) + { + Vector2 center = Main.player[npc.target].Center; + float num2 = 1E+08f; + Vector2 position2 = npc.position; + for (int k = 0; k < 200; k++) + { + if (Main.npc[k].active && (Main.npc[k].type == mod.NPCType("AstrumDeusHeadSpectral") || Main.npc[k].type == mod.NPCType("AstrumDeusBodySpectral") || Main.npc[k].type == mod.NPCType("AstrumDeusTailSpectral"))) + { + float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); + if (num3 < num2) + { + num2 = num3; + position2 = Main.npc[k].position; + } + } + } + npc.position = position2; + string key = "Mods.CalamityMod.AstralBossText"; + Color messageColor = Color.Gold; + if (!CalamityWorld.downedStarGod) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge29"), 1, true); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge36"), 1, true); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + CalamityWorld.downedStarGod = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.GreaterHealingPotion, Main.rand.Next(8, 15)); + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AstrumDeusTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Stardust"), Main.rand.Next(50, 81)); + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HideofAstrumDeus")); + } + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Quasar")); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.HallowedKey); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Starfall")); + } + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Nebulash")); + } + if (Main.rand.Next(7) == 0) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("AstrumDeusMask"), 1, true); + } + } + } + else if (npc.type == mod.NPCType("DevourerofGodsHead")) + { + CalamityWorld.DoGSecondStageCountdown = 21600; //6 minutes + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + for (int playerIndex = 0; playerIndex < 255; playerIndex++) + { + if (Main.player[playerIndex].active) + { + Player player = Main.player[playerIndex]; + for (int l = 0; l < 22; l++) + { + int hasBuff = player.buffType[l]; + if (hasBuff == mod.BuffType("AdrenalineMode")) + { + player.DelBuff(l); + l = -1; + } + if (hasBuff == mod.BuffType("RageMode")) + { + player.DelBuff(l); + l = -1; + } + } + } + } + } + else if (npc.type == mod.NPCType("DevourerofGodsHeadS")) + { + Vector2 center = Main.player[npc.target].Center; + float num2 = 1E+08f; + Vector2 position2 = npc.position; + for (int k = 0; k < 200; k++) + { + if (Main.npc[k].active && (Main.npc[k].type == mod.NPCType("DevourerofGodsHeadS") || Main.npc[k].type == mod.NPCType("DevourerofGodsBodyS") || Main.npc[k].type == mod.NPCType("DevourerofGodsTailS"))) + { + float num3 = Math.Abs(Main.npc[k].Center.X - center.X) + Math.Abs(Main.npc[k].Center.Y - center.Y); + if (num3 < num2) + { + num2 = num3; + position2 = Main.npc[k].position; + } + } + } + npc.position = position2; + string key = "Mods.CalamityMod.DoGBossText"; + Color messageColor = Color.Cyan; + string key2 = "Mods.CalamityMod.DoGBossText2"; + Color messageColor2 = Color.Orange; + if (!CalamityWorld.downedDoG) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge42"), 1, true); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 6); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 3); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells"), 2); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + } + } + CalamityWorld.downedDoG = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SupremeHealingPotion"), Main.rand.Next(8, 15)); + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DevourerofGodsTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DevourerofGodsMask")); + } + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Norfleet")); + } + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Skullmasher")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DeathhailStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Excelsus")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheObliterator")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Eradicator")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EradicatorMelee")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Deathwind")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaffoftheMechworm")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CosmiliteBar"), Main.rand.Next(25, 35)); + } + } + #endregion + #region ArmorSetLoot + if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).tarraSet) + { + if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && npc.lifeMax > 100 && Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, 58, 1, false, 0, false, false); + } + } + if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).bloodflareSet) + { + if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && Main.rand.Next(2) == 0 && Main.bloodMoon && npc.HasPlayerTarget && (double)(npc.position.Y / 16f) < Main.worldSurface) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodOrb")); + } + } + if (!npc.SpawnedFromStatue && (npc.damage > 5 || npc.boss) && Main.rand.Next(12) == 0 && Main.bloodMoon && npc.HasPlayerTarget && (double)(npc.position.Y / 16f) < Main.worldSurface) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodOrb")); + } + #endregion + #region Thingyouwillneverget + if (npc.type == mod.NPCType("Yharon") && Main.rand.Next(100) == 0 && npc.localAI[2] == 1f) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("YharimsCrystal")); + } + #endregion + #region Rares + if (npc.type == NPCID.PossessedArmor) + { + if (Main.expertMode) + { + if (Main.rand.Next(150) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PsychoticAmulet")); + } + } + else if (Main.rand.Next(200) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PsychoticAmulet")); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PsychoticAmulet")); + } + } + } + else if (npc.type == NPCID.SeaSnail) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeaShell")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SeaShell")); + } + } + else if (npc.type == NPCID.GiantTortoise) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FabledTortoiseShell")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantTortoiseShell")); + } + } + } + else if (Main.rand.Next(7) == 0) + { + if (Main.rand.Next(29) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FabledTortoiseShell")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantTortoiseShell")); + } + } + } + else if (npc.type == NPCID.GiantShelly || npc.type == NPCID.GiantShelly2) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantShell")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantShell")); + } + } + else if (npc.type == NPCID.AnomuraFungus) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FungalCarapace")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FungalCarapace")); + } + } + else if (npc.type == NPCID.Crawdad || npc.type == NPCID.Crawdad2) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrawCarapace")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrawCarapace")); + } + } + else if (npc.type == NPCID.GreenJellyfish) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VitalJelly")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VitalJelly")); + } + } + else if (npc.type == NPCID.PinkJellyfish) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LifeJelly")); + } + } + else if (npc.type == NPCID.BlueJellyfish) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManaJelly")); + } + } + else if (npc.type == NPCID.MossHornet) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Needler")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Needler")); + } + } + else if (npc.type == NPCID.DarkCaster) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientShiv")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientShiv")); + } + } + else if (npc.type == NPCID.BigMimicCorruption || npc.type == NPCID.BigMimicCrimson || npc.type == NPCID.BigMimicHallow || npc.type == NPCID.BigMimicJungle) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CelestialClaymore")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CelestialClaymore")); + } + } + else if (npc.type == NPCID.Clinger) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CursedDagger")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CursedDagger")); + } + } + else if (npc.type == NPCID.Shark) + { + if (Main.expertMode) + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthBlade")); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkToothNecklace); + } + } + else + { + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DepthBlade")); + } + if (Main.rand.Next(30) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkToothNecklace); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.SharkToothNecklace); + } + } + } + } + else if (npc.type == NPCID.PresentMimic) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HolidayHalberd")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("HolidayHalberd")); + } + } + else if (npc.type == NPCID.IchorSticker) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SpearofDestiny")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("IchorSpear")); + } + } + } + else if (Main.rand.Next(25) == 0) + { + if (Main.rand.Next(8) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SpearofDestiny")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("IchorSpear")); + } + } + } + else if (npc.type == NPCID.Harpy && NPC.downedBoss1) + { + if (Main.expertMode) + { + if (Main.rand.Next(30) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SkyGlaze")); + } + } + else if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SkyGlaze")); + } + if (CalamityWorld.defiled) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SkyGlaze")); + } + } + } + else if (npc.type == NPCID.Antlion || npc.type == NPCID.WalkingAntlion || npc.type == NPCID.FlyingAntlion) + { + if (Main.expertMode) + { + if (Main.rand.Next(30) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleBow")); + } + if (Main.rand.Next(30) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleClaws")); + } + } + else + { + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleBow")); + } + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MandibleClaws")); + } + } + } + else if (npc.type == NPCID.TombCrawlerHead) + { + if (Main.expertMode) + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BurntSienna")); + } + } + else + { + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BurntSienna")); + } + } + } + else if (npc.type == NPCID.DuneSplicerHead && NPC.downedPlantBoss) + { + if (Main.expertMode) + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Terracotta")); + } + } + else + { + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Terracotta")); + } + } + } + else if (npc.type == NPCID.MartianSaucerCore) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NullificationRifle")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NullificationRifle")); + } + } + else if (npc.type == NPCID.Demon) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BladecrestOathsword")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BladecrestOathsword")); + } + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); + } + } + else if (npc.type == NPCID.BoneSerpentHead) + { + if (Main.expertMode) + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OldLordOathsword")); + } + } + else if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OldLordOathsword")); + } + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DemonicBoneAsh")); + } + } + else if (npc.type == NPCID.Tim) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); + } + } + else if (npc.type == NPCID.GoblinSorcerer) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlasmaRod")); + } + } + else if (npc.type == NPCID.PirateDeadeye) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProporsePistol")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProporsePistol")); + } + } + else if (npc.type == NPCID.PirateCrossbower) + { + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Arbalest")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RaidersGlory")); + } + } + } + else if (Main.rand.Next(25) == 0) + { + if (Main.rand.Next(8) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Arbalest")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RaidersGlory")); + } + } + } + else if (npc.type == NPCID.GoblinSummoner) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheFirstShadowflame")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheFirstShadowflame")); + } + } + else if (npc.type == NPCID.SandElemental) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WifeinaBottle")); + } + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WifeinaBottlewithBoobs")); + } + } + else + { + if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WifeinaBottle")); + } + } + } + else if (CalamityMod.skeletonList.Contains(npc.type)) + { + if (!Main.hardMode) + { + if (Main.expertMode) + { + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Waraxe")); + } + } + else if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Waraxe")); + } + } + if (Main.expertMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); + } + } + else if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AncientBoneDust")); + } + } + else if (npc.type == NPCID.GoblinWarrior) + { + if (Main.expertMode) + { + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Warblade")); + } + } + else if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Warblade")); + } + } + else if (npc.type == NPCID.MartianWalker) + { + if (Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Wingman")); + } + } + else if (Main.rand.Next(7) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Wingman")); + } + } + else if (npc.type == NPCID.GiantCursedSkull || npc.type == NPCID.NecromancerArmored || npc.type == NPCID.Necromancer) + { + if (npc.type == NPCID.GiantCursedSkull) + { + if (CalamityWorld.downedLeviathan && Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Keelhaul")); + } + } + if (Main.expertMode) + { + if (Main.rand.Next(20) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WrathoftheAncients")); + } + } + else if (Main.rand.Next(25) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("WrathoftheAncients")); + } + } + #endregion + #region Commons + if (npc.type == NPCID.Vulture) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertFeather"), Main.rand.Next(1, 3)); + } + } + else if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DesertFeather")); + } + } + else if (CalamityMod.dungeonEnemyBuffList.Contains(npc.type)) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Ectoblood"), Main.rand.Next(1, 3)); + } + } + else if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Ectoblood")); + } + } + else if (npc.type == NPCID.RedDevil) + { + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + else if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofChaos")); + } + } + else if (npc.type == NPCID.WyvernHead) + { + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder"), Main.rand.Next(1, 3)); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); + } + } + else if (npc.type == NPCID.AngryNimbus) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder")); + } + } + else if (npc.type == NPCID.IceTortoise || npc.type == NPCID.IcyMerman) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum")); + } + } + else if (npc.type == NPCID.IceGolem) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum"), Main.rand.Next(1, 3)); + } + else if (npc.type == NPCID.Plantera) + { + if (!Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LivingShard"), Main.rand.Next(6, 10)); + } + } + else if (npc.type == NPCID.NebulaBrain || npc.type == NPCID.NebulaSoldier || npc.type == NPCID.NebulaHeadcrab || npc.type == NPCID.NebulaBeast) + { + if (Main.expertMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MeldBlob"), Main.rand.Next(2, 4)); + } + } + else if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MeldBlob"), (Main.rand.Next(1, 3))); + } + } + else if (npc.type == NPCID.CultistBoss) + { + if (!Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StardustStaff")); + } + } + else + { + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StardustStaff")); + } + } + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ThornBlossom")); + } + } + else if (npc.type == NPCID.EyeofCthulhu) + { + if (!Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(2, 5)); + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TeardropCleaver")); + } + } + } + else if (npc.type == NPCID.DevourerHead || npc.type == NPCID.SeekerHead) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FetidEssence")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FetidEssence")); + } + } + else if (npc.type == NPCID.FaceMonster || npc.type == NPCID.Herpling) + { + if (Main.expertMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodlettingEssence")); + } + } + else if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodlettingEssence")); + } + } + else if (npc.type == NPCID.ManEater) + { + if (Main.expertMode) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManeaterBulb")); + } + } + else if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ManeaterBulb")); + } + } + else if (npc.type == NPCID.AngryTrapper) + { + if (Main.expertMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrapperBulb")); + } + } + else if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TrapperBulb")); + } + } + else if (npc.type == NPCID.MotherSlime || npc.type == NPCID.Crimslime || npc.type == NPCID.CorruptSlime) + { + if (Main.expertMode) + { + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkySludge")); + } + } + else if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkySludge")); + } + } + else if (npc.type == NPCID.Moth) + { + if (Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GypsyPowder")); + } + else if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GypsyPowder")); + } + } + else if (npc.type == NPCID.Derpling) + { + if (Main.expertMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BeetleJuice")); + } + } + else if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BeetleJuice")); + } + } + else if (npc.type == NPCID.SpikedJungleSlime || npc.type == NPCID.Arapaima) + { + if (Main.expertMode) + { + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkyPaste")); + } + } + else if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MurkyPaste")); + } + } + #endregion + #region Boss Specials + if (npc.boss && !CalamityWorld.downedBossAny) + { + CalamityWorld.downedBossAny = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail || npc.type == NPCID.BrainofCthulhu) + { + if (npc.boss) + { + bool downedEvil = CalamityWorld.downedWhar; + CalamityWorld.downedWhar = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + if (!downedEvil) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); + if (WorldGen.crimson) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge8"), 1, true); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge11"), 1, true); + } + else + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge9"), 1, true); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge12"), 1, true); + } + } + } + } + else if (npc.type == NPCID.SkeletronHead) + { + if (!Main.expertMode) + { + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ClothiersWrath")); + } + } + bool downedSkull = CalamityWorld.downedSkullHead; + CalamityWorld.downedSkullHead = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + if (!downedSkull) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 3); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge17"), 1, true); + } + } + else if (npc.type == NPCID.WallofFlesh) + { + if (WorldGenerationMethods.checkAstralMeteor()) + { + if (!CalamityWorld.spawnAstralMeteor) + { + string key = "Mods.CalamityMod.AstralText"; + Color messageColor = Color.Gold; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + CalamityWorld.spawnAstralMeteor = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + WorldGenerationMethods.dropAstralMeteor(); + } + else if (Main.rand.Next(2) == 0 && !CalamityWorld.spawnAstralMeteor2) + { + string key = "Mods.CalamityMod.AstralText"; + Color messageColor = Color.Gold; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + CalamityWorld.spawnAstralMeteor2 = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + WorldGenerationMethods.dropAstralMeteor(); + } + else if (Main.rand.Next(4) == 0 && !CalamityWorld.spawnAstralMeteor3) + { + string key = "Mods.CalamityMod.AstralText"; + Color messageColor = Color.Gold; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + CalamityWorld.spawnAstralMeteor3 = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + WorldGenerationMethods.dropAstralMeteor(); + } + } + if (!Main.expertMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MLGRune")); + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Meowthrower")); + } + if (Main.rand.Next(8) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RogueEmblem")); + } + if (Main.rand.Next(5) == 0) + { + switch (Main.rand.Next(2)) + { + case 0: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CrimsonKey); + break; + case 1: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.CorruptionKey); + break; + } + } + } + bool hardMode = CalamityWorld.downedUgly; + CalamityWorld.downedUgly = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + string key2 = "Mods.CalamityMod.UglyBossText"; + Color messageColor2 = Color.Aquamarine; + if (!hardMode) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 3); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge7"), 1, true); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge18"), 1, true); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + } + } + } + else if (npc.type == NPCID.SkeletronPrime || npc.type == mod.NPCType("BrimstoneElemental")) + { + bool downedPrime = CalamityWorld.downedSkeletor; + if (npc.type == NPCID.SkeletronPrime) + { + CalamityWorld.downedSkeletor = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + string key = "Mods.CalamityMod.SteelSkullBossText"; + Color messageColor = Color.Crimson; + if (!downedPrime && !CalamityWorld.downedBrimstoneElemental) + { + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + if (npc.type == mod.NPCType("BrimstoneElemental")) + { + if (!CalamityWorld.downedBrimstoneElemental) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge6"), 1, true); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge26"), 1, true); + } + CalamityWorld.downedBrimstoneElemental = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else if (npc.type == NPCID.Plantera || npc.type == mod.NPCType("CalamitasRun3")) + { + bool downedPlant = CalamityWorld.downedPlantThing; + if (npc.type == NPCID.Plantera) + { + if (!Main.expertMode) + { + if (Main.rand.Next(5) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.JungleKey); + } + } + CalamityWorld.downedPlantThing = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + string key = "Mods.CalamityMod.PlantBossText"; + Color messageColor = Color.RoyalBlue; + string key2 = "Mods.CalamityMod.PlantOreText"; + Color messageColor2 = Color.GreenYellow; + if (npc.type == mod.NPCType("CalamitasRun3")) + { + if (!CalamityWorld.downedCalamitas && !downedPlant) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), + (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + } + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + npc.DropItemInstanced(npc.position, npc.Size, ItemID.BrokenHeroSword, 1, true); + if (!CalamityWorld.downedCalamitas) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge24"), 1, true); + } + CalamityWorld.downedCalamitas = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + if (npc.type == NPCID.Plantera) + { + if (!downedPlant) + { + WorldGenerationMethods.spawnOre(mod.TileType("PerennialOre"), 12E-05, .5f, .7f); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + } + } + if (!downedPlant && !CalamityWorld.downedCalamitas) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/WyrmScream"), + (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + } + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + } + } + else if (npc.type == NPCID.Golem) + { + bool downedIdiot = CalamityWorld.downedGolemBaby; + CalamityWorld.downedGolemBaby = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + string key = "Mods.CalamityMod.BabyBossText"; + Color messageColor = Color.Lime; + string key2 = "Mods.CalamityMod.BabyBossText2"; + Color messageColor2 = Color.Yellow; + if (!downedIdiot) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge31"), 1, true); + npc.DropItemInstanced(npc.position, npc.Size, ItemID.Picksaw, 1, true); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + } + } + } + else if (npc.type == NPCID.MoonLordCore) + { + bool downedMoonDude = CalamityWorld.downedMoonDude; + CalamityWorld.downedMoonDude = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + string key = "Mods.CalamityMod.MoonBossText"; + Color messageColor = Color.Orange; + string key2 = "Mods.CalamityMod.MoonBossText2"; + Color messageColor2 = Color.Violet; + string key3 = "Mods.CalamityMod.MoonBossText3"; + Color messageColor3 = Color.Crimson; + string key4 = "Mods.CalamityMod.ProfanedBossText2"; + Color messageColor4 = Color.Cyan; + string key5 = "Mods.CalamityMod.FutureOreText"; + Color messageColor5 = Color.LightGray; + if (!Main.expertMode) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("MLGRune2"), 1, true); + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Infinity")); + } + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrandDad")); + } + } + if (!downedMoonDude) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge37"), 1, true); + WorldGenerationMethods.spawnOre(mod.TileType("ExodiumOre"), 12E-05, .01f, .07f); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + Main.NewText(Language.GetTextValue(key2), messageColor2); + Main.NewText(Language.GetTextValue(key3), messageColor3); + Main.NewText(Language.GetTextValue(key4), messageColor4); + Main.NewText(Language.GetTextValue(key5), messageColor5); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key4), messageColor4); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key5), messageColor5); + } + } + } + else if (npc.type == NPCID.DD2Betsy) + { + if (!CalamityWorld.downedBetsy) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + } + CalamityWorld.downedBetsy = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == NPCID.Pumpking && CalamityWorld.downedDoG) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("NightmareFuel"), Main.rand.Next(10, 21)); + } + else if (npc.type == NPCID.IceQueen && CalamityWorld.downedDoG) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EndothermicEnergy"), Main.rand.Next(20, 41)); + } + else if (npc.type == NPCID.Mothron && CalamityWorld.buffedEclipse) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DarksunFragment"), Main.rand.Next(10, 21)); + CalamityWorld.downedBuffedMothron = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("Astrageldon")) + { + if (WorldGenerationMethods.checkAstralMeteor()) + { + string key = "Mods.CalamityMod.AstralText"; + Color messageColor = Color.Gold; + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + WorldGenerationMethods.dropAstralMeteor(); + } + if (!CalamityWorld.downedAstrageldon) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge30"), 1, true); + } + CalamityWorld.downedAstrageldon = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("HiveMindP2")) //boss 2 + { + if (!CalamityWorld.downedHiveMind) + { + if (!CalamityWorld.downedPerforator) + { + string key = "Mods.CalamityMod.SkyOreText"; + Color messageColor = Color.Cyan; + WorldGenerationMethods.spawnOre(mod.TileType("AerialiteOre"), 12E-05, .4f, .6f); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge14"), 1, true); + } + CalamityWorld.downedHiveMind = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("PerforatorHive")) //boss 3 + { + if (!CalamityWorld.downedPerforator) + { + if (!CalamityWorld.downedHiveMind) + { + string key = "Mods.CalamityMod.SkyOreText"; + Color messageColor = Color.Cyan; + WorldGenerationMethods.spawnOre(mod.TileType("AerialiteOre"), 12E-05, .4f, .6f); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge13"), 1, true); + } + CalamityWorld.downedPerforator = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("SlimeGodCore") || npc.type == mod.NPCType("SlimeGodSplit") || npc.type == mod.NPCType("SlimeGodRunSplit")) //boss 4 + { + if (npc.type == mod.NPCType("SlimeGodCore") && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) + && !NPC.AnyNPCs(mod.NPCType("SlimeGod")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) + { + if (!CalamityWorld.downedSlimeGod) + { + if (revenge && !Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("PurifiedJam"), Main.rand.Next(6, 9), true); + Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop = true; + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 3); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge15"), 1, true); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaticRefiner")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurifiedGel"), Main.rand.Next(25, 41)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(180, 251)); + int maskChoice = Main.rand.Next(2); + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OverloadedBlaster")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GelDart"), Main.rand.Next(80, 101)); + } + if (Main.rand.Next(7) == 0) + { + if (maskChoice == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask2")); + } + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AbyssalTome")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EldritchTome")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrimslimeStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CorroslimeStaff")); + } + } + CalamityWorld.downedSlimeGod = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("SlimeGodSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodRunSplit")) && + NPC.CountNPCS(mod.NPCType("SlimeGodSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGodRun"))) + { + if (!CalamityWorld.downedSlimeGod) + { + if (revenge && !Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("PurifiedJam"), Main.rand.Next(6, 9), true); + Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop = true; + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 3); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge15"), 1, true); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaticRefiner")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurifiedGel"), Main.rand.Next(25, 41)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(180, 251)); + int maskChoice = Main.rand.Next(2); + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OverloadedBlaster")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GelDart"), Main.rand.Next(80, 101)); + } + if (Main.rand.Next(7) == 0) + { + if (maskChoice == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask2")); + } + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AbyssalTome")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EldritchTome")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrimslimeStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CorroslimeStaff")); + } + } + CalamityWorld.downedSlimeGod = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("SlimeGodRunSplit") && !NPC.AnyNPCs(mod.NPCType("SlimeGodCore")) && !NPC.AnyNPCs(mod.NPCType("SlimeGodSplit")) && + NPC.CountNPCS(mod.NPCType("SlimeGodRunSplit")) < 2 && !NPC.AnyNPCs(mod.NPCType("SlimeGod"))) + { + if (!CalamityWorld.downedSlimeGod) + { + if (revenge && !Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("PurifiedJam"), Main.rand.Next(6, 9), true); + Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].GetModPlayer(mod).revJamDrop = true; + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 3); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge15"), 1, true); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodTrophy")); + } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("StaticRefiner")); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PurifiedGel"), Main.rand.Next(25, 41)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(180, 251)); + int maskChoice = Main.rand.Next(2); + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OverloadedBlaster")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GelDart"), Main.rand.Next(80, 101)); + } + if (Main.rand.Next(7) == 0) + { + if (maskChoice == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask")); + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SlimeGodMask2")); + } + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AbyssalTome")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EldritchTome")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CrimslimeStaff")); + } + if (Main.rand.Next(4) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CorroslimeStaff")); + } + } + CalamityWorld.downedSlimeGod = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else if (npc.type == mod.NPCType("Cryogen")) //boss 5 + { + if (!CalamityWorld.downedCryogen) + { + string key = "Mods.CalamityMod.IceOreText"; + Color messageColor = Color.LightSkyBlue; + WorldGenerationMethods.spawnOre(mod.TileType("CryonicOre"), 15E-05, .45f, .65f); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge19"), 1, true); + } + CalamityWorld.downedCryogen = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("Leviathan")) //boss 8 + { + int bossType = (npc.type == mod.NPCType("Siren")) ? mod.NPCType("Leviathan") : mod.NPCType("Siren"); + if (!NPC.AnyNPCs(bossType)) + { + if (!CalamityWorld.downedLeviathan) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge10"), 1, true); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge28"), 1, true); + } + CalamityWorld.downedLeviathan = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + } + else if (npc.type == mod.NPCType("PlaguebringerGoliath")) //boss 9 + { + if (!CalamityWorld.downedPlaguebringer) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge32"), 1, true); + } + CalamityWorld.downedPlaguebringer = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("ProfanedGuardianBoss")) //boss 10 + { + if (!CalamityWorld.downedGuardians) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge38"), 1, true); + } + CalamityWorld.downedGuardians = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("Providence")) //boss 11 + { + string key2 = "Mods.CalamityMod.ProfanedBossText3"; + Color messageColor2 = Color.Orange; + string key3 = "Mods.CalamityMod.TreeOreText"; + Color messageColor3 = Color.LightGreen; + if (!CalamityWorld.downedProvidence) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge39"), 1, true); + WorldGenerationMethods.spawnOre(mod.TileType("UelibloomOre"), 15E-05, .4f, .8f); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key2), messageColor2); + Main.NewText(Language.GetTextValue(key3), messageColor3); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key3), messageColor3); + } + } + CalamityWorld.downedProvidence = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("CeaselessVoid")) //boss 12 + { + if (!CalamityWorld.downedSentinel1) + { + if (CalamityWorld.downedSentinel2 && CalamityWorld.downedSentinel3) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge40"), 1, true); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + } + CalamityWorld.downedSentinel1 = true; //21600 + if (CalamityWorld.DoGSecondStageCountdown > 14460) + { + CalamityWorld.DoGSecondStageCountdown = 14460; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + } + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("StormWeaverHeadNaked")) //boss 13 + { + if (!CalamityWorld.downedSentinel2) + { + if (CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel3) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge40"), 1, true); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + } + CalamityWorld.downedSentinel2 = true; //21600 + if (CalamityWorld.DoGSecondStageCountdown > 7260) + { + CalamityWorld.DoGSecondStageCountdown = 7260; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + } + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("CosmicWraith")) //boss 14 + { + if (!CalamityWorld.downedSentinel3) + { + if (CalamityWorld.downedSentinel1 && CalamityWorld.downedSentinel2) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge40"), 1, true); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + } + CalamityWorld.downedSentinel3 = true; //21600 + if (CalamityWorld.DoGSecondStageCountdown > 600) + { + CalamityWorld.DoGSecondStageCountdown = 600; + if (Main.netMode == 2) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.DoGCountdownSync); + netMessage.Write(CalamityWorld.DoGSecondStageCountdown); + netMessage.Send(); + } + } + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("Bumblefuck")) //boss 16 + { + if (!CalamityWorld.downedBumble) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge43"), 1, true); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 5); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + } + CalamityWorld.downedBumble = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("Yharon")) //boss 17 + { + string key = "Mods.CalamityMod.DargonBossText"; + Color messageColor = Color.Orange; + string key2 = "Mods.CalamityMod.AuricOreText"; + Color messageColor2 = Color.Gold; + if (!CalamityWorld.downedYharon && npc.localAI[2] == 1f) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge44"), 1, true); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 6); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 3); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells"), 2); + WorldGenerationMethods.spawnOre(mod.TileType("AuricOre"), 2E-05, .6f, .8f); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key2), messageColor2); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key2), messageColor2); + } + } + if (npc.localAI[2] == 1f) + { + CalamityWorld.downedYharon = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + if (!CalamityWorld.buffedEclipse && npc.localAI[2] != 2f) + { + CalamityWorld.buffedEclipse = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + } + else if (npc.type == mod.NPCType("SupremeCalamitas")) //boss 18 + { + if (!CalamityWorld.downedSCal) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge45"), 1, true); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 6); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 3); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells"), 2); + } + CalamityWorld.downedSCal = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("CrabulonIdle")) //boss 19 + { + if (!CalamityWorld.downedCrabulon) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 2); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge5"), 1, true); + } + CalamityWorld.downedCrabulon = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("ScavengerBody")) //boss 20 + { + if (!CalamityWorld.downedScavenger) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 4); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 2); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells")); + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge33"), 1, true); + } + CalamityWorld.downedScavenger = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("Polterghast")) //boss 21 + { + string key = "Mods.CalamityMod.GhostBossText"; + Color messageColor = Color.RoyalBlue; + if (!CalamityWorld.downedPolterghast) + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("Knowledge41"), 1, true); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MagnumRounds"), 6); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrenadeRounds"), 3); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ExplosiveShells"), 2); + if (Main.netMode == 0) + { + Main.NewText(Language.GetTextValue(key), messageColor); + } + else if (Main.netMode == 2) + { + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + } + } + CalamityWorld.downedPolterghast = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("THELORDE")) //boss 22 + { + CalamityWorld.downedLORDE = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + else if (npc.type == mod.NPCType("GiantClam")) //boss 23 + { + CalamityWorld.downedCLAM = true; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + /*else if (npc.type == mod.NPCType("OldDuke")) //boss 23 + { + CalamityWorld.downedOldDuke = true; + }*/ + if (CalamityWorld.death) + { + if (npc.type == mod.NPCType("SupremeCalamitas")) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Levi")); + } + } + #endregion + } + #endregion + + #region DespawnHostileProjectiles + public void DespawnProj() + { + int proj; + for (int x = 0; x < 1000; x = proj + 1) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active && projectile.hostile && !projectile.friendly && projectile.damage > 0) + { + projectile.Kill(); + } + proj = x; + } + } + #endregion + } +} \ No newline at end of file diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 6f9a9d2d77..8aa1a7cc5e 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items; using CalamityMod.Projectiles; namespace CalamityMod.NPCs.CeaselessVoid @@ -16,7 +17,6 @@ namespace CalamityMod.NPCs.CeaselessVoid private float bossLife; private float beamPortal = 0f; private float shootBoost = 0; - private float passedVar = 1f; public override void SetStaticDefaults() { @@ -123,7 +123,7 @@ namespace CalamityMod.NPCs.CeaselessVoid { beamPortal += 4f; } - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { beamPortal += 2f; } @@ -159,13 +159,13 @@ namespace CalamityMod.NPCs.CeaselessVoid double offsetAngle; int damage = expertMode ? 42 : 58; int i; + float passedVar = 1f; for (i = 0; i < 4; i++) { offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), mod.ProjectileType("DarkEnergyBall"), damage, 0f, Main.myPlayer, passedVar, 0f); passedVar += 1f; } - passedVar = 1f; } } } @@ -259,7 +259,14 @@ namespace CalamityMod.NPCs.CeaselessVoid } if (Main.rand.Next(5) == 0) { - npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ArcanumoftheVoid"), 1, true); + if (Main.rand.Next(8) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheEvolution")); + } + else + { + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("ArcanumoftheVoid"), 1, true); + } } } } diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index c628d7864b..b6fd6ce121 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -37,7 +37,9 @@ namespace CalamityMod.NPCs.CeaselessVoid { npc.lifeMax = 44000; } - npc.knockBackResist = 0.25f; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0.25f; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; diff --git a/NPCs/CeaselessVoid/DarkEnergy2.cs b/NPCs/CeaselessVoid/DarkEnergy2.cs index 9be67c45c7..9eb1a94c9f 100644 --- a/NPCs/CeaselessVoid/DarkEnergy2.cs +++ b/NPCs/CeaselessVoid/DarkEnergy2.cs @@ -37,7 +37,9 @@ namespace CalamityMod.NPCs.CeaselessVoid { npc.lifeMax = 44000; } - npc.knockBackResist = 0.1f; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0.1f; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; diff --git a/NPCs/CeaselessVoid/DarkEnergy3.cs b/NPCs/CeaselessVoid/DarkEnergy3.cs index 3ba107bb93..eb3c13705a 100644 --- a/NPCs/CeaselessVoid/DarkEnergy3.cs +++ b/NPCs/CeaselessVoid/DarkEnergy3.cs @@ -36,7 +36,9 @@ namespace CalamityMod.NPCs.CeaselessVoid { npc.lifeMax = 44000; } - npc.aiStyle = -1; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; //new aiType = -1; //new npc.knockBackResist = 0.3f; npc.noGravity = true; diff --git a/NPCs/CosmicWraith/CosmicLantern.cs b/NPCs/CosmicWraith/CosmicLantern.cs index 8a5fcbf884..a4076a8aa5 100644 --- a/NPCs/CosmicWraith/CosmicLantern.cs +++ b/NPCs/CosmicWraith/CosmicLantern.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.CosmicWraith { npc.aiStyle = -1; aiType = -1; - npc.damage = 100; + npc.damage = 110; npc.width = 25; //324 npc.height = 25; //216 npc.defense = 85; @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.CosmicWraith public override void AI() { npc.alpha -= 3; - if (npc.alpha <= 0) + if (npc.alpha < 0) { npc.alpha = 0; int num1262 = Dust.NewDust(npc.position, npc.width, npc.height, 204, 0f, 0f, 0, default(Color), 0.25f); @@ -92,7 +92,7 @@ namespace CalamityMod.NPCs.CosmicWraith npc.velocity.X = (npc.velocity.X * 100f + num1258) / 101f; npc.velocity.Y = (npc.velocity.Y * 100f + num1259) / 101f; } - + public override void OnHitPlayer(Player player, int damage, bool crit) { if (CalamityWorld.revenge) @@ -104,7 +104,7 @@ namespace CalamityMod.NPCs.CosmicWraith public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 0; - return true; + return npc.alpha == 0; } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/CosmicWraith/CosmicWraith.cs b/NPCs/CosmicWraith/CosmicWraith.cs index 1a641cff79..340306e0aa 100644 --- a/NPCs/CosmicWraith/CosmicWraith.cs +++ b/NPCs/CosmicWraith/CosmicWraith.cs @@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.CosmicWraith public override void SetDefaults() { npc.npcSlots = 32f; - npc.damage = 150; + npc.damage = 175; npc.width = 130; npc.height = 130; npc.defense = 70; @@ -59,6 +59,8 @@ namespace CalamityMod.NPCs.CosmicWraith { npc.lifeMax = CalamityWorld.death ? 2400000 : 2200000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; //new aiType = -1; //new @@ -66,18 +68,18 @@ namespace CalamityMod.NPCs.CosmicWraith for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("ExoFreeze")] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("ExoFreeze")] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.noGravity = true; npc.noTileCollide = true; npc.netAlways = true; @@ -104,16 +106,17 @@ namespace CalamityMod.NPCs.CosmicWraith float num998 = 8f; float scaleFactor3 = 300f; float num999 = 800f; - float num1000 = cosmicSpeed ? 12f : 15f; //should be lower + float num1000 = cosmicSpeed ? 12f : 15f; float num1001 = 5f; - float scaleFactor4 = 0.75f; //should be 0.75 - int num1002 = 0; //should be 0 + float scaleFactor4 = 0.75f; + int num1002 = 0; float scaleFactor5 = 10f; float num1003 = 30f; float num1004 = 150f; - float num1005 = cosmicSpeed ? 12f : 15f; //should be lower + float num1005 = cosmicSpeed ? 12f : 15f; float num1006 = 0.333333343f; - float num1007 = 10f; //yes + float num1007 = 10f; + float chargeSpeedDivisor = cosmicSpeed ? 11.85f : 14.85f; num1006 *= num1005; for (int num1011 = 0; num1011 < 2; num1011++) { @@ -156,7 +159,7 @@ namespace CalamityMod.NPCs.CosmicWraith if (Main.netMode != 1) { int speed2 = revenge ? 13 : 12; - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { speed2 += 3; } @@ -198,7 +201,7 @@ namespace CalamityMod.NPCs.CosmicWraith { speed = expertMode ? 16f : 14f; } - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { speed += 3f; } @@ -255,7 +258,6 @@ namespace CalamityMod.NPCs.CosmicWraith } else if (npc.ai[0] == 1f) { - npc.damage = 0; npc.dontTakeDamage = true; npc.chaseable = false; npc.alpha += (cosmicTeleport ? 5 : 4); @@ -266,7 +268,6 @@ namespace CalamityMod.NPCs.CosmicWraith npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); npc.ai[0] = 2f; npc.netUpdate = true; - return; } } else if (npc.ai[0] == 2f) @@ -320,7 +321,6 @@ namespace CalamityMod.NPCs.CosmicWraith Main.dust[num625].velocity *= 2f; } } - npc.damage = expertMode ? 240 : 150; npc.dontTakeDamage = false; npc.chaseable = true; npc.ai[3] += 1f; @@ -337,7 +337,6 @@ namespace CalamityMod.NPCs.CosmicWraith npc.ai[0] = 0f; } npc.netUpdate = true; - return; } } else if (npc.ai[0] == 3f) @@ -372,7 +371,7 @@ namespace CalamityMod.NPCs.CosmicWraith if (Main.netMode != 1) { float num1070 = 15f; //changed from 10 - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1070 += 3f; } @@ -459,12 +458,10 @@ namespace CalamityMod.NPCs.CosmicWraith npc.ai[2] = 0f; npc.ai[3] = 0f; npc.netUpdate = true; - return; } } else if (npc.ai[0] == 4f) { - npc.damage = expertMode ? 240 : 150; npc.dontTakeDamage = false; npc.chaseable = true; if (Main.netMode != 1) @@ -505,7 +502,7 @@ namespace CalamityMod.NPCs.CosmicWraith } npc.spriteDirection = Math.Sign(npc.velocity.X); phaseSwitch += 1f; - if (chargeSwitch == 0f) + if (chargeSwitch == 0f) //line up the charge { float scaleFactor6 = num998; Vector2 center4 = npc.Center; @@ -524,8 +521,8 @@ namespace CalamityMod.NPCs.CosmicWraith flag64 = (flag64 && vector126.ToRotation() > 3.14159274f / num1014 && vector126.ToRotation() < 3.14159274f - 3.14159274f / num1014); if (num1013 > num999 || !flag64) { - npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / (cosmicSpeed ? 11.75f : 14.8f); //num1000 12f 15f - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / (cosmicSpeed ? 11.75f : 14.8f); //num1000 12f 15f + npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / chargeSpeedDivisor; + npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / chargeSpeedDivisor; if (!flag64) { npc.ai[3] += 1f; @@ -547,7 +544,7 @@ namespace CalamityMod.NPCs.CosmicWraith npc.netUpdate = true; } } - else if (chargeSwitch == 1f) + else if (chargeSwitch == 1f) //pause before charge { npc.velocity *= scaleFactor4; npc.ai[1] += 1f; @@ -562,7 +559,7 @@ namespace CalamityMod.NPCs.CosmicWraith npc.velocity = velocity; } } - else if (chargeSwitch == 2f) + else if (chargeSwitch == 2f) //charging { if (Main.netMode != 1) { @@ -572,14 +569,13 @@ namespace CalamityMod.NPCs.CosmicWraith Main.PlaySound(SoundID.Item73, npc.position); int damage = expertMode ? 49 : 62; Vector2 vector173 = Vector2.Normalize(player.Center - vectorCenter) * (float)(npc.width + 20) / 2f + vectorCenter; - int projectile = Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, (float)(npc.direction * 2), 4f, mod.ProjectileType("EssenceDust"), damage, 0f, Main.myPlayer, 0f, 0f); //changed + int projectile = Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, (float)(npc.direction * 2), 4f, mod.ProjectileType("EssenceDust"), damage, 0f, Main.myPlayer, 0f, 0f); Main.projectile[projectile].timeLeft = 60; Main.projectile[projectile].velocity.X = 0f; Main.projectile[projectile].velocity.Y = 0f; dustTimer = 3; } } - npc.damage = expertMode ? 320 : 200; float num1016 = num1003; npc.ai[1] += 1f; bool flag65 = Vector2.Distance(npc.Center, player.Center) > num1004 && npc.Center.Y > player.Center.Y; @@ -591,7 +587,7 @@ namespace CalamityMod.NPCs.CosmicWraith npc.velocity /= 2f; npc.netUpdate = true; npc.ai[1] = 45f; - chargeSwitch = 4f; + chargeSwitch = 3f; } else { @@ -603,23 +599,22 @@ namespace CalamityMod.NPCs.CosmicWraith { vec2 = new Vector2((float)npc.direction, 0f); } - npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / (cosmicSpeed ? 11.65f : 14.75f); //num1005 12f 15f + npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / chargeSpeedDivisor; } } - else if (chargeSwitch == 4f) + else if (chargeSwitch == 3f) //slow down after charging and reset { - npc.ai[1] -= 3f; + npc.ai[1] -= 2f; if (npc.ai[1] <= 0f) { chargeSwitch = 0f; npc.ai[1] = 0f; npc.netUpdate = true; } - npc.velocity *= 0.95f; + npc.velocity *= 0.97f; } if (phaseSwitch > 300f) { - npc.damage = expertMode ? 240 : 150; npc.ai[0] = 0f; npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -627,7 +622,6 @@ namespace CalamityMod.NPCs.CosmicWraith chargeSwitch = 0f; phaseSwitch = 0f; npc.netUpdate = true; - return; } } } @@ -635,7 +629,7 @@ namespace CalamityMod.NPCs.CosmicWraith public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; - return true; + return npc.alpha == 0; } public override void FindFrame(int frameHeight) @@ -672,7 +666,6 @@ namespace CalamityMod.NPCs.CosmicWraith { spriteEffects = SpriteEffects.FlipHorizontally; } - Color lightColor = (drawColor != null ? (Color)drawColor : CalamityMod.GetNPCColor(((NPC)npc), npc.Center, false)); int frameCount = Main.npcFrameCount[npc.type]; float scale = npc.scale; float rotation = npc.rotation; @@ -693,7 +686,7 @@ namespace CalamityMod.NPCs.CosmicWraith new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)width * scale / 2f + vector.X * scale, npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)height * scale / (float)frameCount + 4f + vector.Y * scale + 0f + offsetY), new Microsoft.Xna.Framework.Rectangle?(frame), - npc.GetAlpha(lightColor), + npc.GetAlpha(drawColor), rotation, vector, scale, @@ -715,7 +708,7 @@ namespace CalamityMod.NPCs.CosmicWraith new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * scale / 2f + vector11.X * scale, npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * scale / (float)frameCount + 4f + vector11.Y * scale + 0f + offsetY), new Microsoft.Xna.Framework.Rectangle?(frame2), - npc.GetAlpha(lightColor), + npc.GetAlpha(drawColor), rotation, vector11, scale, diff --git a/NPCs/Crabulon/CrabulonIdle.cs b/NPCs/Crabulon/CrabulonIdle.cs index adfdd23705..2af294caa4 100644 --- a/NPCs/Crabulon/CrabulonIdle.cs +++ b/NPCs/Crabulon/CrabulonIdle.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.Crabulon npc.width = 164; //324 npc.height = 154; //216 npc.defense = 8; - npc.lifeMax = CalamityWorld.revenge ? 2640 : 1800; + npc.lifeMax = CalamityWorld.revenge ? 4000 : 3000; if (CalamityWorld.death) { npc.lifeMax = 6930; @@ -37,6 +37,8 @@ namespace CalamityMod.NPCs.Crabulon { npc.lifeMax = CalamityWorld.death ? 2300000 : 2000000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.aiStyle = -1; //new aiType = -1; //new npc.buffImmune[mod.BuffType("GlacialState")] = true; @@ -177,7 +179,6 @@ namespace CalamityMod.NPCs.Crabulon int sporeDust = Dust.NewDust(npc.position, npc.width, npc.height, 56, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); Main.dust[sporeDust].noGravity = true; Main.dust[sporeDust].velocity *= 0.5f; - npc.damage = 0; npc.ai[1] += 1f; if (npc.justHit || npc.ai[1] >= 420f) { @@ -188,7 +189,6 @@ namespace CalamityMod.NPCs.Crabulon } else if (npc.ai[0] == 1f) { - npc.damage = 0; npc.velocity.X *= 0.98f; npc.velocity.Y *= 0.98f; npc.ai[1] += 1f; @@ -203,7 +203,6 @@ namespace CalamityMod.NPCs.Crabulon } else if (npc.ai[0] == 2f) { - npc.damage = expertMode ? 64 : 40; float num823 = 1.25f; bool flag51 = false; if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) @@ -214,7 +213,7 @@ namespace CalamityMod.NPCs.Crabulon { num823 = 2f; } - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num823 = 8f; } @@ -300,12 +299,10 @@ namespace CalamityMod.NPCs.Crabulon if (npc.velocity.Y > 10f) { npc.velocity.Y = 10f; - return; } } else if (npc.ai[0] == 3f) { - npc.damage = expertMode ? 64 : 40; npc.noTileCollide = false; if (npc.velocity.Y == 0f) { @@ -398,7 +395,7 @@ namespace CalamityMod.NPCs.Crabulon { num626 += 1f; } - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num626 += 3f; } @@ -452,12 +449,16 @@ namespace CalamityMod.NPCs.Crabulon NetMessage.SendData(23, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0); } } - return; } } } } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return npc.ai[0] > 1f; + } + public override void FindFrame(int frameHeight) { npc.frameCounter += 0.15f; diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index d9136d26c7..09310883ba 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -40,6 +40,8 @@ namespace CalamityMod.NPCs.Cryogen { npc.lifeMax = CalamityWorld.death ? 3000000 : 2700000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.aiStyle = -1; //new aiType = -1; //new animationType = 10; //new @@ -48,23 +50,23 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.OnFire] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("BrimstoneFlames")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.OnFire] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("BrimstoneFlames")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.boss = true; npc.noGravity = true; npc.noTileCollide = true; @@ -113,6 +115,14 @@ namespace CalamityMod.NPCs.Cryogen npc.localAI[1] -= 1f; } } + if (npc.ai[0] == 0f || npc.ai[0] == 2f || npc.ai[0] == 4f) + { + npc.rotation = npc.velocity.X * 0.1f; + } + else if (npc.ai[0] == 1f || npc.ai[0] == 3f) + { + npc.rotation = 0f; + } if (oneTime) { RainStart(); @@ -202,17 +212,11 @@ namespace CalamityMod.NPCs.Cryogen { num1246 = 10f; } - if (num1245 < num1246) - { - npc.velocity.X = num1243; - npc.velocity.Y = num1244; - } - else - { - num1245 = num1246 / num1245; - npc.velocity.X = num1243 * num1245; - npc.velocity.Y = num1244 * num1245; - } + num1245 = num1246 / num1245; + num1243 *= num1245; + num1244 *= num1245; + 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) { npc.ai[0] = 1f; @@ -404,17 +408,11 @@ namespace CalamityMod.NPCs.Cryogen { num1246 = 14f; } - if (num1245 < num1246) - { - npc.velocity.X = num1243; - npc.velocity.Y = num1244; - } - else - { - num1245 = num1246 / num1245; - npc.velocity.X = num1243 * num1245; - npc.velocity.Y = num1244 * num1245; - } + num1245 = num1246 / num1245; + num1243 *= num1245; + num1244 *= num1245; + 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) { npc.ai[0] = 3f; @@ -543,7 +541,7 @@ namespace CalamityMod.NPCs.Cryogen if (Main.netMode != 1) { npc.localAI[0] += 1f; - if (npc.localAI[0] >= 60f && npc.alpha <= 0) + if (npc.localAI[0] >= 60f && npc.alpha == 0) { npc.localAI[0] = 0f; npc.TargetClosest(true); @@ -577,17 +575,11 @@ namespace CalamityMod.NPCs.Cryogen { speed = 9f; } - if (num1245 < speed) - { - npc.velocity.X = num1243; - npc.velocity.Y = num1244; - } - else - { - num1245 = speed / num1245; - npc.velocity.X = num1243 * num1245; - npc.velocity.Y = num1244 * num1245; - } + num1245 = speed / num1245; + num1243 *= num1245; + num1244 *= num1245; + npc.velocity.X = (npc.velocity.X * 50f + num1243) / 51f; + npc.velocity.Y = (npc.velocity.Y * 50f + num1244) / 51f; if (npc.ai[1] == 0f) { npc.chaseable = true; @@ -628,7 +620,6 @@ namespace CalamityMod.NPCs.Cryogen } else if (npc.ai[1] == 1f) { - npc.damage = 0; npc.dontTakeDamage = true; npc.chaseable = false; npc.alpha += 4; @@ -646,7 +637,6 @@ namespace CalamityMod.NPCs.Cryogen npc.alpha -= 4; if (npc.alpha <= 0) { - npc.damage = expertMode ? 96 : 60; npc.dontTakeDamage = false; npc.chaseable = true; npc.alpha = 0; @@ -851,6 +841,11 @@ namespace CalamityMod.NPCs.Cryogen npc.damage = (int)(npc.damage * 0.8f); } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return npc.alpha == 0; + } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) @@ -982,6 +977,10 @@ namespace CalamityMod.NPCs.Cryogen { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CryogenMask")); } + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Regenator")); + } if (Main.rand.Next(4) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BittercoldStaff")); diff --git a/NPCs/Cryogen/CryogenIce.cs b/NPCs/Cryogen/CryogenIce.cs index 3fde803628..211a3cb6cb 100644 --- a/NPCs/Cryogen/CryogenIce.cs +++ b/NPCs/Cryogen/CryogenIce.cs @@ -40,7 +40,7 @@ namespace CalamityMod.NPCs.Cryogen public override void AI() { npc.alpha -= 3; - if (npc.alpha <= 0) + if (npc.alpha < 0) { npc.alpha = 0; } @@ -63,7 +63,12 @@ namespace CalamityMod.NPCs.Cryogen } } - public override void OnHitPlayer(Player player, int damage, bool crit) + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + return npc.alpha == 0; + } + + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(BuffID.Frostburn, 90, true); player.AddBuff(BuffID.Chilled, 60, true); diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 442606ba9d..15c96258d3 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -33,6 +33,8 @@ namespace CalamityMod.NPCs.DesertScourge { npc.lifeMax = CalamityWorld.death ? 4500000 : 4100000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new @@ -88,7 +90,7 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.netMode != 1 && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) { npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { npc.localAI[0] += 4f; } diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index da29711c33..5ae4f124c1 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -46,7 +46,9 @@ namespace CalamityMod.NPCs.DesertScourge { npc.lifeMax = CalamityWorld.death ? 4500000 : 4100000; } - npc.aiStyle = 6; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; @@ -56,7 +58,6 @@ namespace CalamityMod.NPCs.DesertScourge for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[mod.BuffType("ExoFreeze")] = false; } npc.behindTiles = true; npc.noGravity = true; @@ -86,7 +87,7 @@ namespace CalamityMod.NPCs.DesertScourge { speedMult = 1.6f; } - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { speedMult = 2f; } @@ -179,7 +180,7 @@ namespace CalamityMod.NPCs.DesertScourge { npc.localAI[1] = 1f; Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num954 = (npc.GetGlobalNPC(mod).enraged ? 500 : 1000); + int num954 = ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 500 : 1000); bool flag95 = true; if (npc.position.Y > player.position.Y) { diff --git a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs index edff64eed2..cd257b3192 100644 --- a/NPCs/DesertScourge/DesertScourgeHeadSmall.cs +++ b/NPCs/DesertScourge/DesertScourgeHeadSmall.cs @@ -48,7 +48,6 @@ namespace CalamityMod.NPCs.DesertScourge for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[mod.BuffType("ExoFreeze")] = false; } npc.behindTiles = true; npc.noGravity = true; diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index ae8edd1cef..35e985d87b 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -33,6 +33,8 @@ namespace CalamityMod.NPCs.DesertScourge { npc.lifeMax = CalamityWorld.death ? 4500000 : 4100000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 91a6969722..5473fcb7f6 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -11,30 +11,30 @@ using Terraria.GameContent.Events; namespace CalamityMod.NPCs.GreatSandShark { - public class GreatSandShark : ModNPC + public class GreatSandShark : ModNPC { - private bool resetAI = false; + private bool resetAI = false; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Great Sand Shark"); Main.npcFrameCount[npc.type] = 8; } - + public override void SetDefaults() { - npc.noGravity = true; - npc.noTileCollide = true; - npc.npcSlots = 15f; - npc.damage = 100; + npc.noGravity = true; + npc.noTileCollide = true; + npc.npcSlots = 15f; + npc.damage = 100; npc.width = 300; npc.height = 120; npc.defense = 60; npc.lifeMax = CalamityWorld.revenge ? 11000 : 8000; - if (CalamityWorld.death) - { - npc.lifeMax = 16000; - } + if (CalamityWorld.death) + { + npc.lifeMax = 16000; + } npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; @@ -43,536 +43,536 @@ namespace CalamityMod.NPCs.GreatSandShark NPCID.Sets.TrailingMode[npc.type] = 1; for (int k = 0; k < npc.buffImmune.Length; k++) { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - } - npc.behindTiles = true; - npc.netAlways = true; - npc.HitSound = SoundID.NPCHit1; + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; + npc.behindTiles = true; + npc.netAlways = true; + npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.timeLeft = NPC.activeTime * 30; + npc.timeLeft = NPC.activeTime * 30; banner = npc.type; bannerItem = mod.ItemType("GreatSandSharkBanner"); } - + public override void AI() { bool expertMode = Main.expertMode; bool revenge = CalamityWorld.revenge; - bool death = CalamityWorld.death; - bool lowLife = (double)npc.life <= (double)npc.lifeMax * (expertMode ? 0.75 : 0.5); - bool lowerLife = (double)npc.life <= (double)npc.lifeMax * (expertMode ? 0.35 : 0.2); - bool youMustDie = !Main.player[npc.target].ZoneDesert; - if (!Sandstorm.Happening) - { - Main.raining = false; - Sandstorm.Happening = true; - Sandstorm.TimeLeft = (int)(3600f * (8f + Main.rand.NextFloat() * 16f)); - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - if (npc.soundDelay <= 0) - { - npc.soundDelay = 480; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)npc.position.X, (int)npc.position.Y); - } - if (npc.localAI[3] >= 1f || Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 1000f) - { - if (!resetAI) - { - npc.localAI[0] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - resetAI = true; - npc.netUpdate = true; - } - int num2 = expertMode ? 35 : 50; - float num3 = expertMode ? 0.5f : 0.42f; - float scaleFactor = expertMode ? 7.5f : 6.7f; - int num4 = expertMode ? 28 : 30; - float num5 = expertMode ? 15.5f : 14f; - if (revenge || lowerLife) - { - num3 *= 1.1f; - scaleFactor *= 1.1f; - num5 *= 1.1f; - } - if (death) - { - num3 *= 1.1f; - scaleFactor *= 1.1f; - num5 *= 1.1f; - num4 = 25; - } - if (youMustDie) - { - num3 *= 1.5f; - scaleFactor *= 1.5f; - num5 *= 1.5f; - num4 = 20; - } - Vector2 vector = npc.Center; - Player player = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) - { - npc.TargetClosest(true); - player = Main.player[npc.target]; - npc.netUpdate = true; - } - if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) - { - npc.velocity.Y = npc.velocity.Y + 0.4f; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - npc.ai[0] = 0f; - npc.ai[2] = 0f; - } - float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); - if (npc.spriteDirection == 1) - { - num17 += 3.14159274f; - } - if (num17 < 0f) - { - num17 += 6.28318548f; - } - if (num17 > 6.28318548f) - { - num17 -= 6.28318548f; - } - float num18 = 0.04f; - if (npc.ai[0] == 1f) - { - num18 = 0f; - } - if (npc.rotation < num17) - { - if ((double)(num17 - npc.rotation) > 3.1415926535897931) - { - npc.rotation -= num18; - } - else - { - npc.rotation += num18; - } - } - if (npc.rotation > num17) - { - if ((double)(npc.rotation - num17) > 3.1415926535897931) - { - npc.rotation += num18; - } - else - { - npc.rotation -= num18; - } - } - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - { - npc.rotation = num17; - } - if (npc.rotation < 0f) - { - npc.rotation += 6.28318548f; - } - if (npc.rotation > 6.28318548f) - { - npc.rotation -= 6.28318548f; - } - if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) - { - npc.rotation = num17; - } - if (npc.ai[0] == 0f && !player.dead) - { - if (npc.ai[1] == 0f) - { - npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); - } - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; - if (npc.velocity.X < vector3.X) - { - npc.velocity.X = npc.velocity.X + num3; - if (npc.velocity.X < 0f && vector3.X > 0f) - { - npc.velocity.X = npc.velocity.X + num3; - } - } - else if (npc.velocity.X > vector3.X) - { - npc.velocity.X = npc.velocity.X - num3; - if (npc.velocity.X > 0f && vector3.X < 0f) - { - npc.velocity.X = npc.velocity.X - num3; - } - } - if (npc.velocity.Y < vector3.Y) - { - npc.velocity.Y = npc.velocity.Y + num3; - if (npc.velocity.Y < 0f && vector3.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num3; - } - } - else if (npc.velocity.Y > vector3.Y) - { - npc.velocity.Y = npc.velocity.Y - num3; - if (npc.velocity.Y > 0f && vector3.Y < 0f) - { - npc.velocity.Y = npc.velocity.Y - num3; - } - } - int num22 = Math.Sign(player.Center.X - vector.X); - if (num22 != 0) - { - if (npc.ai[2] == 0f && num22 != npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.direction = num22; - if (npc.spriteDirection != -npc.direction) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - vector) * num5; - npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - if (num22 != 0) - { - npc.direction = num22; - if (npc.spriteDirection == 1) - { - npc.rotation += 3.14159274f; - } - npc.spriteDirection = -npc.direction; - } - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] == 1f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num4) - { - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 2f) - { - npc.localAI[3] = 0f; - } - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return; - } - } - } - else - { - resetAI = false; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - Point point15 = npc.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(point15); - bool flag121 = tileSafely.nactive() || tileSafely.liquid > 0; - bool flag122 = false; - npc.TargetClosest(false); - Vector2 vector260 = npc.targetRect.Center.ToVector2(); - if (Main.player[npc.target].velocity.Y > -0.1f && !Main.player[npc.target].dead && npc.Distance(vector260) > 150f) - { - flag122 = true; - } - npc.localAI[1] += 1f; - if (lowLife) - { - bool spawnFlag = npc.localAI[1] == 150f; - if (NPC.CountNPCS(NPCID.SandShark) > 2) - { - spawnFlag = false; - } - if (spawnFlag && Main.netMode != 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 50, NPCID.SandShark, 0, 0f, 0f, 0f, 0f, 255); - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)npc.position.X, (int)npc.position.Y); - } - } - if (npc.localAI[1] >= 300f) - { - npc.localAI[1] = 0f; - if (npc.localAI[2] > 0f) - { - npc.localAI[2] = 0f; - } - switch (Main.rand.Next(3)) - { - case 0: - npc.ai[3] = 0f; - break; - case 1: - npc.ai[3] = 1f; - break; - case 2: - npc.ai[3] = 2f; - break; - } - int random = lowerLife ? 5 : 9; - if (lowLife && Main.rand.Next(random) == 0) - { - npc.localAI[3] = 1f; - } - npc.netUpdate = true; - } - if (npc.localAI[0] == -1f && !flag121) - { - npc.localAI[0] = 20f; - } - if (npc.localAI[0] > 0f) - { - npc.localAI[0] -= 1f; - } - if (flag121) - { - float num1534 = npc.ai[1]; - bool flag123 = false; - point15 = (npc.Center + new Vector2(0f, 24f)).ToTileCoordinates(); - tileSafely = Framing.GetTileSafely(point15.X, point15.Y - 2); - if (tileSafely.nactive()) - { - flag123 = true; - } - npc.ai[1] = (float)flag123.ToInt(); - if (npc.ai[2] < 30f) - { - npc.ai[2] += 1f; - } - if (flag122) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.15f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; - float velocityX = 8f; - float velocityY = 6f; - switch ((int)npc.ai[3]) - { - case 0: - velocityX = 10f; velocityY = 9f; - break; - case 1: - velocityX = 14f; velocityY = 7f; - break; - case 2: - velocityX = 8f; velocityY = 11f; - break; - } - if (revenge || lowerLife) - { - velocityX *= 1.1f; - velocityY *= 1.1f; - } - if (youMustDie) - { - velocityX *= 1.5f; - velocityY *= 1.5f; - } - if (npc.velocity.X > velocityX) - { - npc.velocity.X = velocityX; - } - if (npc.velocity.X < -velocityX) - { - npc.velocity.X = -velocityX; - } - if (npc.velocity.Y > velocityY) - { - npc.velocity.Y = velocityY; - } - if (npc.velocity.Y < -velocityY) - { - npc.velocity.Y = -velocityY; - } - Vector2 vec4 = npc.Center + npc.velocity.SafeNormalize(Vector2.Zero) * npc.Size.Length() / 2f + npc.velocity; - point15 = vec4.ToTileCoordinates(); - tileSafely = Framing.GetTileSafely(point15); - bool flag124 = tileSafely.nactive(); - if (!flag124 && Math.Sign(npc.velocity.X) == npc.direction && (npc.Distance(vector260) < 600f || youMustDie) && - (npc.ai[2] >= 30f || npc.ai[2] < 0f)) - { - if (npc.localAI[0] == 0f) - { - Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 15); - npc.localAI[0] = -1f; - for (int num621 = 0; num621 < 25; num621++) - { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 32, 0f, 0f, 100, default(Color), 2f); - Main.dust[num622].velocity.Y *= 6f; - Main.dust[num622].velocity.X *= 3f; - if (Main.rand.Next(2) == 0) - { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int num623 = 0; num623 < 50; num623++) - { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 85, 0f, 0f, 100, default(Color), 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity.Y *= 10f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 268, 0f, 0f, 100, default(Color), 2f); - Main.dust[num624].velocity.X *= 2f; - } - int spawnX = (int)(npc.width / 2); - for (int sand = 0; sand < 5; sand++) - Projectile.NewProjectile(npc.Center.X + (float)Main.rand.Next(-spawnX, spawnX), npc.Center.Y, - (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), mod.ProjectileType("GreatSandBlast"), 40, 0f, Main.myPlayer, 0f, 0f); - } - npc.ai[2] = -30f; - Vector2 vector261 = npc.DirectionTo(vector260 + new Vector2(0f, -80f)); - npc.velocity = vector261 * 18f; //12 - } - } - else - { - float num1535 = 6f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -num1535 || npc.velocity.X > num1535) - { - npc.velocity.X = npc.velocity.X * 0.95f; //.95 - } - if (flag123) - { - npc.ai[0] = -1f; - } - else - { - npc.ai[0] = 1f; - } - float num1536 = 0.06f; - float num1537 = 0.01f; - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - num1537; - if (npc.velocity.Y < -num1536) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + num1537; - if (npc.velocity.Y > num1536) - { - npc.ai[0] = -1f; - } - } - if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - } - else - { - if (npc.velocity.Y == 0f) - { - if (flag122) - { - npc.TargetClosest(true); - } - float num1538 = 1f; - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -num1538 || npc.velocity.X > num1538) - { - npc.velocity.X = npc.velocity.X * 0.95f; //.95 - } - } - if (npc.localAI[2] == 0f) - { - npc.localAI[2] = 1f; - float velocityX = 12f; - float velocityY = 12f; - switch ((int)npc.ai[3]) - { - case 0: - velocityX = 12f; velocityY = 12f; - break; - case 1: - velocityX = 14f; velocityY = 14f; - break; - case 2: - velocityX = 16f; velocityY = 16f; - break; - } - if (revenge || lowerLife) - { - velocityX *= 1.1f; - velocityY *= 1.1f; - } - if (youMustDie) - { - velocityX *= 1.5f; - velocityY *= 1.5f; - } - npc.velocity.Y = -velocityY; - npc.velocity.X = velocityX * (float)npc.direction; - npc.netUpdate = true; - } - npc.velocity.Y = npc.velocity.Y + 0.4f; //0.3 - if (npc.velocity.Y > 10f) - { - npc.velocity.Y = 10f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if (npc.rotation < -0.1f) - { - npc.rotation = -0.1f; - } - if (npc.rotation > 0.1f) - { - npc.rotation = 0.1f; - } - } - } + bool death = CalamityWorld.death; + bool lowLife = (double)npc.life <= (double)npc.lifeMax * (expertMode ? 0.75 : 0.5); + bool lowerLife = (double)npc.life <= (double)npc.lifeMax * (expertMode ? 0.35 : 0.2); + bool youMustDie = !Main.player[npc.target].ZoneDesert; + if (!Sandstorm.Happening) + { + Main.raining = false; + Sandstorm.Happening = true; + Sandstorm.TimeLeft = (int)(3600f * (8f + Main.rand.NextFloat() * 16f)); + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + if (npc.soundDelay <= 0) + { + npc.soundDelay = 480; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)npc.position.X, (int)npc.position.Y); + } + if (npc.localAI[3] >= 1f || Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 1000f) + { + if (!resetAI) + { + npc.localAI[0] = 0f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + resetAI = true; + npc.netUpdate = true; + } + int num2 = expertMode ? 35 : 50; + float num3 = expertMode ? 0.5f : 0.42f; + float scaleFactor = expertMode ? 7.5f : 6.7f; + int num4 = expertMode ? 28 : 30; + float num5 = expertMode ? 15.5f : 14f; + if (revenge || lowerLife) + { + num3 *= 1.1f; + scaleFactor *= 1.1f; + num5 *= 1.1f; + } + if (death) + { + num3 *= 1.1f; + scaleFactor *= 1.1f; + num5 *= 1.1f; + num4 = 25; + } + if (youMustDie) + { + num3 *= 1.5f; + scaleFactor *= 1.5f; + num5 *= 1.5f; + num4 = 20; + } + Vector2 vector = npc.Center; + Player player = Main.player[npc.target]; + if (npc.target < 0 || npc.target == 255 || player.dead || !player.active) + { + npc.TargetClosest(true); + player = Main.player[npc.target]; + npc.netUpdate = true; + } + if (player.dead || Vector2.Distance(player.Center, vector) > 5600f) + { + npc.velocity.Y = npc.velocity.Y + 0.4f; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + npc.ai[0] = 0f; + npc.ai[2] = 0f; + } + float num17 = (float)Math.Atan2((double)(player.Center.Y - vector.Y), (double)(player.Center.X - vector.X)); + if (npc.spriteDirection == 1) + { + num17 += 3.14159274f; + } + if (num17 < 0f) + { + num17 += 6.28318548f; + } + if (num17 > 6.28318548f) + { + num17 -= 6.28318548f; + } + float num18 = 0.04f; + if (npc.ai[0] == 1f) + { + num18 = 0f; + } + if (npc.rotation < num17) + { + if ((double)(num17 - npc.rotation) > 3.1415926535897931) + { + npc.rotation -= num18; + } + else + { + npc.rotation += num18; + } + } + if (npc.rotation > num17) + { + if ((double)(npc.rotation - num17) > 3.1415926535897931) + { + npc.rotation += num18; + } + else + { + npc.rotation -= num18; + } + } + if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + { + npc.rotation = num17; + } + if (npc.rotation < 0f) + { + npc.rotation += 6.28318548f; + } + if (npc.rotation > 6.28318548f) + { + npc.rotation -= 6.28318548f; + } + if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18) + { + npc.rotation = num17; + } + if (npc.ai[0] == 0f && !player.dead) + { + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X)); + } + Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor; + if (npc.velocity.X < vector3.X) + { + npc.velocity.X = npc.velocity.X + num3; + if (npc.velocity.X < 0f && vector3.X > 0f) + { + npc.velocity.X = npc.velocity.X + num3; + } + } + else if (npc.velocity.X > vector3.X) + { + npc.velocity.X = npc.velocity.X - num3; + if (npc.velocity.X > 0f && vector3.X < 0f) + { + npc.velocity.X = npc.velocity.X - num3; + } + } + if (npc.velocity.Y < vector3.Y) + { + npc.velocity.Y = npc.velocity.Y + num3; + if (npc.velocity.Y < 0f && vector3.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num3; + } + } + else if (npc.velocity.Y > vector3.Y) + { + npc.velocity.Y = npc.velocity.Y - num3; + if (npc.velocity.Y > 0f && vector3.Y < 0f) + { + npc.velocity.Y = npc.velocity.Y - num3; + } + } + int num22 = Math.Sign(player.Center.X - vector.X); + if (num22 != 0) + { + if (npc.ai[2] == 0f && num22 != npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.direction = num22; + if (npc.spriteDirection != -npc.direction) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num2) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.velocity = Vector2.Normalize(player.Center - vector) * num5; + npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); + if (num22 != 0) + { + npc.direction = num22; + if (npc.spriteDirection == 1) + { + npc.rotation += 3.14159274f; + } + npc.spriteDirection = -npc.direction; + } + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] == 1f) + { + npc.ai[2] += 1f; + if (npc.ai[2] >= (float)num4) + { + npc.localAI[3] += 1f; + if (npc.localAI[3] >= 2f) + { + npc.localAI[3] = 0f; + } + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + return; + } + } + } + else + { + resetAI = false; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + Point point15 = npc.Center.ToTileCoordinates(); + Tile tileSafely = Framing.GetTileSafely(point15); + bool flag121 = tileSafely.nactive() || tileSafely.liquid > 0; + bool flag122 = false; + npc.TargetClosest(false); + Vector2 vector260 = npc.targetRect.Center.ToVector2(); + if (Main.player[npc.target].velocity.Y > -0.1f && !Main.player[npc.target].dead && npc.Distance(vector260) > 150f) + { + flag122 = true; + } + npc.localAI[1] += 1f; + if (lowLife) + { + bool spawnFlag = npc.localAI[1] == 150f; + if (NPC.CountNPCS(NPCID.SandShark) > 2) + { + spawnFlag = false; + } + if (spawnFlag && Main.netMode != 1) + { + NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 50, NPCID.SandShark, 0, 0f, 0f, 0f, 0f, 255); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/GreatSandSharkRoar"), (int)npc.position.X, (int)npc.position.Y); + } + } + if (npc.localAI[1] >= 300f) + { + npc.localAI[1] = 0f; + if (npc.localAI[2] > 0f) + { + npc.localAI[2] = 0f; + } + switch (Main.rand.Next(3)) + { + case 0: + npc.ai[3] = 0f; + break; + case 1: + npc.ai[3] = 1f; + break; + case 2: + npc.ai[3] = 2f; + break; + } + int random = lowerLife ? 5 : 9; + if (lowLife && Main.rand.Next(random) == 0) + { + npc.localAI[3] = 1f; + } + npc.netUpdate = true; + } + if (npc.localAI[0] == -1f && !flag121) + { + npc.localAI[0] = 20f; + } + if (npc.localAI[0] > 0f) + { + npc.localAI[0] -= 1f; + } + if (flag121) + { + float num1534 = npc.ai[1]; + bool flag123 = false; + point15 = (npc.Center + new Vector2(0f, 24f)).ToTileCoordinates(); + tileSafely = Framing.GetTileSafely(point15.X, point15.Y - 2); + if (tileSafely.nactive()) + { + flag123 = true; + } + npc.ai[1] = (float)flag123.ToInt(); + if (npc.ai[2] < 30f) + { + npc.ai[2] += 1f; + } + if (flag122) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.15f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.15f; + float velocityX = 8f; + float velocityY = 6f; + switch ((int)npc.ai[3]) + { + case 0: + velocityX = 10f; velocityY = 9f; + break; + case 1: + velocityX = 14f; velocityY = 7f; + break; + case 2: + velocityX = 8f; velocityY = 11f; + break; + } + if (revenge || lowerLife) + { + velocityX *= 1.1f; + velocityY *= 1.1f; + } + if (youMustDie) + { + velocityX *= 1.5f; + velocityY *= 1.5f; + } + if (npc.velocity.X > velocityX) + { + npc.velocity.X = velocityX; + } + if (npc.velocity.X < -velocityX) + { + npc.velocity.X = -velocityX; + } + if (npc.velocity.Y > velocityY) + { + npc.velocity.Y = velocityY; + } + if (npc.velocity.Y < -velocityY) + { + npc.velocity.Y = -velocityY; + } + Vector2 vec4 = npc.Center + npc.velocity.SafeNormalize(Vector2.Zero) * npc.Size.Length() / 2f + npc.velocity; + point15 = vec4.ToTileCoordinates(); + tileSafely = Framing.GetTileSafely(point15); + bool flag124 = tileSafely.nactive(); + if (!flag124 && Math.Sign(npc.velocity.X) == npc.direction && (npc.Distance(vector260) < 600f || youMustDie) && + (npc.ai[2] >= 30f || npc.ai[2] < 0f)) + { + if (npc.localAI[0] == 0f) + { + Main.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 15); + npc.localAI[0] = -1f; + for (int num621 = 0; num621 < 25; num621++) + { + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 32, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity.Y *= 6f; + Main.dust[num622].velocity.X *= 3f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 50; num623++) + { + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 85, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity.Y *= 10f; + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 268, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity.X *= 2f; + } + int spawnX = (int)(npc.width / 2); + for (int sand = 0; sand < 5; sand++) + Projectile.NewProjectile(npc.Center.X + (float)Main.rand.Next(-spawnX, spawnX), npc.Center.Y, + (float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), mod.ProjectileType("GreatSandBlast"), 40, 0f, Main.myPlayer, 0f, 0f); + } + npc.ai[2] = -30f; + Vector2 vector261 = npc.DirectionTo(vector260 + new Vector2(0f, -80f)); + npc.velocity = vector261 * 18f; //12 + } + } + else + { + float num1535 = 6f; + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -num1535 || npc.velocity.X > num1535) + { + npc.velocity.X = npc.velocity.X * 0.95f; //.95 + } + if (flag123) + { + npc.ai[0] = -1f; + } + else + { + npc.ai[0] = 1f; + } + float num1536 = 0.06f; + float num1537 = 0.01f; + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - num1537; + if (npc.velocity.Y < -num1536) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + num1537; + if (npc.velocity.Y > num1536) + { + npc.ai[0] = -1f; + } + } + if (npc.velocity.Y > 0.4f || npc.velocity.Y < -0.4f) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + } + else + { + if (npc.velocity.Y == 0f) + { + if (flag122) + { + npc.TargetClosest(true); + } + float num1538 = 1f; + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -num1538 || npc.velocity.X > num1538) + { + npc.velocity.X = npc.velocity.X * 0.95f; //.95 + } + } + if (npc.localAI[2] == 0f) + { + npc.localAI[2] = 1f; + float velocityX = 12f; + float velocityY = 12f; + switch ((int)npc.ai[3]) + { + case 0: + velocityX = 12f; velocityY = 12f; + break; + case 1: + velocityX = 14f; velocityY = 14f; + break; + case 2: + velocityX = 16f; velocityY = 16f; + break; + } + if (revenge || lowerLife) + { + velocityX *= 1.1f; + velocityY *= 1.1f; + } + if (youMustDie) + { + velocityX *= 1.5f; + velocityY *= 1.5f; + } + npc.velocity.Y = -velocityY; + npc.velocity.X = velocityX * (float)npc.direction; + npc.netUpdate = true; + } + npc.velocity.Y = npc.velocity.Y + 0.4f; //0.3 + if (npc.velocity.Y > 10f) + { + npc.velocity.Y = 10f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if (npc.rotation < -0.1f) + { + npc.rotation = -0.1f; + } + if (npc.rotation > 0.1f) + { + npc.rotation = 0.1f; + } + } + } - public override void FindFrame(int frameHeight) - { - if (npc.localAI[3] == 0f) - { - npc.spriteDirection = -npc.direction; - } - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + if (npc.localAI[3] == 0f) + { + npc.spriteDirection = -npc.direction; + } + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { @@ -599,10 +599,10 @@ namespace CalamityMod.NPCs.GreatSandShark { goto IL_6899; } - IL_6881: + IL_6881: num161 += num158; continue; - IL_6899: + IL_6899: float num164 = (float)(num157 - num161); if (num158 < 0) { @@ -648,25 +648,25 @@ namespace CalamityMod.NPCs.GreatSandShark } } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrandScale")); - if (Main.expertMode && Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrandScale")); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrandScale")); + if (Main.expertMode && Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GrandScale")); + } + } - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); npc.damage = (int)(npc.damage * 0.8f); } - + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(BuffID.Rabies, 240, true); - player.AddBuff(BuffID.Bleeding, 240, true); - } + player.AddBuff(BuffID.Bleeding, 240, true); + } } } \ No newline at end of file diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 072e0eb696..cdba4b95a1 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -37,7 +37,9 @@ namespace CalamityMod.NPCs.HiveMind { npc.lifeMax = CalamityWorld.death ? 400000 : 350000; } - npc.aiStyle = -1; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; //new aiType = -1; //new npc.buffImmune[mod.BuffType("GlacialState")] = true; npc.buffImmune[mod.BuffType("TemporalSadness")] = true; @@ -158,7 +160,7 @@ namespace CalamityMod.NPCs.HiveMind int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); int num663 = mod.NPCType("HiveBlob"); - if (Main.rand.Next(3) == 0 || npc.GetGlobalNPC(mod).enraged) + if (Main.rand.Next(3) == 0 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num663 = mod.NPCType("DankCreeper"); } diff --git a/NPCs/HiveMind/HiveMindP2.cs b/NPCs/HiveMind/HiveMindP2.cs index ceab7c1aa5..54a74eeedb 100644 --- a/NPCs/HiveMind/HiveMindP2.cs +++ b/NPCs/HiveMind/HiveMindP2.cs @@ -72,6 +72,8 @@ namespace CalamityMod.NPCs.HiveMind { npc.lifeMax = CalamityWorld.death ? 1600000 : 1400000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.aiStyle = -1; //new aiType = -1; //new npc.buffImmune[mod.BuffType("GlacialState")] = true; diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index b732df30e8..e2f37178c5 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -35,6 +35,8 @@ namespace CalamityMod.NPCs.Leviathan { npc.lifeMax = CalamityWorld.death ? 8000000 : 7000000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; aiType = -1; @@ -42,20 +44,20 @@ namespace CalamityMod.NPCs.Leviathan for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.HitSound = SoundID.NPCHit56; npc.DeathSound = SoundID.NPCDeath60; npc.noTileCollide = true; @@ -105,7 +107,7 @@ namespace CalamityMod.NPCs.Leviathan bool flag6 = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); if (flag6 || !sirenAlive || CalamityWorld.death) { - npc.defense = npc.defDefense * 2; + npc.defense = 80; } else { @@ -256,7 +258,7 @@ namespace CalamityMod.NPCs.Leviathan num418 = sirenAlive ? 14f : 17f; num419 = 33; } - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num418 = 22f; } @@ -434,7 +436,7 @@ namespace CalamityMod.NPCs.Leviathan { num1044 += 2f; //2 not a prob } - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1044 += 4f; } @@ -462,7 +464,7 @@ namespace CalamityMod.NPCs.Leviathan num1048 += 2f; //2 not a prob num1049 += 0.1f; //0.1 not a prob } - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1048 += 3f; num1049 += 0.2f; diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 1737b82ab7..681e0ba253 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -47,6 +47,8 @@ namespace CalamityMod.NPCs.Leviathan { npc.lifeMax = CalamityWorld.death ? 2800000 : 2600000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; //new aiType = -1; //new @@ -55,21 +57,21 @@ namespace CalamityMod.NPCs.Leviathan for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Plague")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Plague")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; @@ -93,21 +95,22 @@ namespace CalamityMod.NPCs.Leviathan float scaleFactor3 = 300f; float num999 = 800f; float num1001 = 5f; - float scaleFactor4 = 0.75f; + float scaleFactor4 = 0.8f; int num1002 = 0; float scaleFactor5 = 10f; float num1003 = 30f; float num1004 = 150f; float num1006 = 0.333333343f; - float num1007 = 10f; + float num1007 = 8f; Vector2 vector = npc.Center; Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); bool isNotOcean = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); int npcType = mod.NPCType("Leviathan"); bool halfLife = (double)npc.life <= (double)npc.lifeMax * 0.5; bool leviAlive = NPC.AnyNPCs(npcType); - float num1000 = leviAlive ? 14f : 18f; - float num1005 = leviAlive ? 14f : 18f; + float num1000 = leviAlive ? 14f : 16f; + float num1005 = leviAlive ? 14f : 16f; + float chargeSpeedDivisor = leviAlive ? 13.85f : 15.85f; num1006 *= num1005; if ((halfLife || CalamityWorld.death || CalamityWorld.bossRushActive) && Main.netMode != 1) { @@ -130,7 +133,7 @@ namespace CalamityMod.NPCs.Leviathan int defenseMult = phase2 ? 2 : 3; if ((!leviAlive && halfLife) || CalamityWorld.death) { - npc.defense = npc.defDefense * defenseMult; + npc.defense = 25 * defenseMult; } else { @@ -391,7 +394,7 @@ namespace CalamityMod.NPCs.Leviathan Vector2 vector121 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.4f); npc.ai[1] += 1f; bool flag104 = false; - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { if (npc.ai[1] % 10f == 9f) { @@ -431,7 +434,7 @@ namespace CalamityMod.NPCs.Leviathan if (Main.netMode != 1) { float num1070 = revenge ? 13f : 11f; - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1070 = 24f; } @@ -555,7 +558,7 @@ namespace CalamityMod.NPCs.Leviathan { phaseSwitch += 1f; } - if (chargeSwitch == 0f) + if (chargeSwitch == 0f) //line up the charge { float scaleFactor6 = num998; Vector2 center4 = npc.Center; @@ -574,8 +577,8 @@ namespace CalamityMod.NPCs.Leviathan flag64 = (flag64 && vector126.ToRotation() > 3.14159274f / num1014 && vector126.ToRotation() < 3.14159274f - 3.14159274f / num1014); if (num1013 > num999 || !flag64) { - npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / (leviAlive ? 13.9f : 17.8f); //14f 18f - npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / (leviAlive ? 13.9f : 17.8f); //14f 18f + npc.velocity.X = (npc.velocity.X * (num1000 - 1f) + vector127.X) / chargeSpeedDivisor; + npc.velocity.Y = (npc.velocity.Y * (num1000 - 1f) + vector127.Y) / chargeSpeedDivisor; if (!flag64) { anotherFloat += 1f; @@ -597,7 +600,7 @@ namespace CalamityMod.NPCs.Leviathan npc.netUpdate = true; } } - else if (chargeSwitch == 1f) + else if (chargeSwitch == 1f) //pause before charging { npc.velocity *= scaleFactor4; npc.ai[1] += 1f; @@ -612,7 +615,7 @@ namespace CalamityMod.NPCs.Leviathan npc.velocity = velocity; } } - else if (chargeSwitch == 2f) + else if (chargeSwitch == 2f) //charging { float num1016 = num1003; npc.ai[1] += 1f; @@ -626,7 +629,7 @@ namespace CalamityMod.NPCs.Leviathan npc.velocity /= 2f; npc.netUpdate = true; npc.ai[1] = 45f; - chargeSwitch = 4f; + chargeSwitch = 3f; } else { @@ -641,16 +644,16 @@ namespace CalamityMod.NPCs.Leviathan npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; } } - else if (chargeSwitch == 4f) + else if (chargeSwitch == 3f) //slow down after charging and reset { - npc.ai[1] -= 3f; + npc.ai[1] -= 1f; if (npc.ai[1] <= 0f) { chargeSwitch = 0f; npc.ai[1] = 0f; npc.netUpdate = true; } - npc.velocity *= 0.95f; + npc.velocity *= 0.98f; } if (phaseSwitch > 300f) { diff --git a/NPCs/NormalNPCs/AngryDog.cs b/NPCs/NormalNPCs/AngryDog.cs index 7accef5bfb..c91bda9b26 100644 --- a/NPCs/NormalNPCs/AngryDog.cs +++ b/NPCs/NormalNPCs/AngryDog.cs @@ -648,6 +648,10 @@ namespace CalamityMod.NPCs.NormalNPCs { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Leather, Main.rand.Next(1, 3)); } + if (Main.rand.Next(100) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Cryophobia")); + } } } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 3ea0aa6e94..531932c2e6 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -435,6 +435,10 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("LeadWizard")); + } if (Main.rand.Next(3) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DraedonsRemote")); diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index 0d667b903a..20e8c69cc9 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -7,6 +7,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Projectiles; +using CalamityMod.Items; namespace CalamityMod.NPCs.NormalNPCs { @@ -320,7 +321,10 @@ namespace CalamityMod.NPCs.NormalNPCs Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VictoryShard"), Main.rand.Next(1, 4)); if (Main.rand.Next(4) == 0) { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AmidiasSpark")); + if (Main.rand.Next(25) == 0) + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("TheTransformer")); + else + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AmidiasSpark")); } } } diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index c473dc8cec..4476decdc8 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -74,6 +74,10 @@ namespace CalamityMod.NPCs.NormalNPCs { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EbonianGel"), Main.rand.Next(15, 17)); Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Gel, Main.rand.Next(10, 15)); + if (Main.rand.Next(100) == 0 && NPC.downedBoss3) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Carnage")); + } } } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index 1519c205c3..e8d2ff03c1 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -377,7 +377,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - if (Main.rand.Next(3) == 0) + if (Main.rand.Next(2) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum")); } diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index 18a5f3b6d1..5ba2eb1d5a 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -12,284 +12,280 @@ namespace CalamityMod.NPCs.NormalNPCs { public class Eidolist : ModNPC { - public bool hasBeenHit = false; + public bool hasBeenHit = false; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Eidolist"); Main.npcFrameCount[npc.type] = 6; } - + public override void SetDefaults() { npc.aiStyle = -1; - aiType = -1; + aiType = -1; npc.damage = 0; npc.width = 60; //324 npc.height = 80; //216 npc.defense = 0; npc.lifeMax = 10000; - if (CalamityWorld.death) - { - npc.lifeMax = 13000; - } + if (CalamityWorld.death) + { + npc.lifeMax = 13000; + } npc.knockBackResist = 0f; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - } - npc.value = Item.buyPrice(0, 1, 0, 0); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.value = Item.buyPrice(0, 1, 0, 0); npc.alpha = 50; npc.noGravity = true; npc.noTileCollide = false; npc.HitSound = SoundID.NPCHit13; npc.DeathSound = SoundID.NPCDeath59; - npc.timeLeft = NPC.activeTime * 2; + npc.timeLeft = NPC.activeTime * 2; banner = npc.type; bannerItem = mod.ItemType("EidolistBanner"); } - public override void AI() - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.4f, 0.5f); - if (npc.justHit || CalamityGlobalNPC.AnyBossNPCS()) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (!hasBeenHit) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.localAI[2] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.localAI[2] = 1f; - } - } - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -2f || npc.velocity.X > 2f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.localAI[2] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.localAI[2] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.localAI[2] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - return; - } - npc.noTileCollide = true; - float num1446 = 7f; - int num1447 = 480; - float num244; - if (npc.localAI[1] == 1f) - { - npc.localAI[1] = 0f; - if (Main.rand.Next(4) == 0) - { - npc.ai[0] = (float)num1447; - } - } - npc.TargetClosest(true); - npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.1f; - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); - Vector2 vector251 = Main.player[npc.target].Center - value53; - bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); - npc.localAI[0] += 1f; - if (Main.netMode != 1 && npc.localAI[0] >= 300f) - { - npc.localAI[0] = 0f; - 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 speed = 5f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-10, 11); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-10, 11); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int damage = 40; - if (Main.expertMode) - { - damage = 30; - } - int random = Main.rand.Next(2); - if (random == 0) - { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, 465, damage, 0f, Main.myPlayer, 0f, 0f); - } - else - { - Vector2 vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); - vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center + Main.player[npc.target].velocity * 20f); - if (vec.HasNaNs()) - { - vec = new Vector2((float)npc.direction, 0f); - } - for (int n = 0; n < 1; n++) - { - Vector2 vector4 = vec * 4f; - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector4.X, vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - } - } - if (vector251.Length() > 400f || !flag104) - { - Vector2 value54 = vector251; - if (value54.Length() > num1446) - { - value54.Normalize(); - value54 *= num1446; - } - int num1448 = 30; - npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; - } - else - { - npc.velocity *= 0.98f; - } - if (npc.ai[2] != 0f && npc.ai[3] != 0f) - { - Main.PlaySound(SoundID.Item8, npc.Center); - int num; - for (int num1449 = 0; num1449 < 20; num1449 = num + 1) - { - int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, 20, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1450]; - dust.velocity *= 3f; - Main.dust[num1450].noGravity = true; - Main.dust[num1450].scale = 2.5f; - num = num1449; - } - npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); - npc.velocity = Vector2.Zero; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - Main.PlaySound(SoundID.Item8, npc.Center); - for (int num1451 = 0; num1451 < 20; num1451 = num + 1) - { - int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, 20, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1452]; - dust.velocity *= 3f; - Main.dust[num1452].noGravity = true; - Main.dust[num1452].scale = 2.5f; - num = num1451; - } - } - float[] var_9_48E3C_cp_0 = npc.ai; - int var_9_48E3C_cp_1 = 0; - num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; - var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; - if (npc.ai[0] >= (float)num1447 && Main.netMode != 1) - { - npc.ai[0] = 0f; - Point point12 = npc.Center.ToTileCoordinates(); - Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); - int num1453 = 20; - int num1454 = 3; - int num1455 = 10; - int num1456 = 1; - int num1457 = 0; - bool flag106 = false; - if (vector251.Length() > 2000f) - { - flag106 = true; - } - while (!flag106 && num1457 < 100) - { - num1457++; - int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); - int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); - if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) - { - bool flag107 = true; - if (flag107 && Main.tile[num1458, num1459].lava()) - { - flag107 = false; - } - if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) - { - flag107 = false; - } - if (flag107) - { - npc.ai[2] = (float)num1458; - npc.ai[3] = (float)num1459; - break; - } - } - } - npc.netUpdate = true; - } - } - - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) + public override void AI() { - if (!Main.hardMode) - { - return 0f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) - { - return 0.05f; - } - if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer4 && spawnInfo.water) - { - return 0.1f; - } - return spawnInfo.player.ZoneDungeon ? 0.04f : 0f; + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.4f, 0.5f); + if (npc.justHit || CalamityGlobalNPC.AnyBossNPCS()) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (!hasBeenHit) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.localAI[2] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.localAI[2] = 1f; + } + } + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -2f || npc.velocity.X > 2f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.localAI[2] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.localAI[2] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.localAI[2] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + return; + } + npc.noTileCollide = true; + float num1446 = 7f; + int num1447 = 480; + float num244; + if (npc.localAI[1] == 1f) + { + npc.localAI[1] = 0f; + if (Main.rand.Next(4) == 0) + { + npc.ai[0] = (float)num1447; + } + } + npc.TargetClosest(true); + npc.rotation = Math.Abs(npc.velocity.X) * (float)npc.direction * 0.1f; + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + Vector2 value53 = npc.Center + new Vector2((float)(npc.direction * 20), 6f); + Vector2 vector251 = Main.player[npc.target].Center - value53; + bool flag104 = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1); + npc.localAI[0] += 1f; + if (Main.netMode != 1 && npc.localAI[0] >= 300f) + { + npc.localAI[0] = 0f; + 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 speed = 5f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-10, 11); + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-10, 11); + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + int damage = 40; + if (Main.expertMode) + { + damage = 30; + } + int random = Main.rand.Next(2); + if (random == 0) + { + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, 465, damage, 0f, Main.myPlayer, 0f, 0f); + } + else + { + Vector2 vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center); + vec = Vector2.Normalize(Main.player[npc.target].Center - npc.Center + Main.player[npc.target].velocity * 20f); + if (vec.HasNaNs()) + { + vec = new Vector2((float)npc.direction, 0f); + } + for (int n = 0; n < 1; n++) + { + Vector2 vector4 = vec * 4f; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, vector4.X, vector4.Y, 464, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + } + } + if (vector251.Length() > 400f || !flag104) + { + Vector2 value54 = vector251; + if (value54.Length() > num1446) + { + value54.Normalize(); + value54 *= num1446; + } + int num1448 = 30; + npc.velocity = (npc.velocity * (float)(num1448 - 1) + value54) / (float)num1448; + } + else + { + npc.velocity *= 0.98f; + } + if (npc.ai[2] != 0f && npc.ai[3] != 0f) + { + Main.PlaySound(SoundID.Item8, npc.Center); + int num; + for (int num1449 = 0; num1449 < 20; num1449 = num + 1) + { + int num1450 = Dust.NewDust(npc.position, npc.width, npc.height, 20, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[num1450]; + dust.velocity *= 3f; + Main.dust[num1450].noGravity = true; + Main.dust[num1450].scale = 2.5f; + num = num1449; + } + npc.Center = new Vector2(npc.ai[2] * 16f, npc.ai[3] * 16f); + npc.velocity = Vector2.Zero; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + Main.PlaySound(SoundID.Item8, npc.Center); + for (int num1451 = 0; num1451 < 20; num1451 = num + 1) + { + int num1452 = Dust.NewDust(npc.position, npc.width, npc.height, 20, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[num1452]; + dust.velocity *= 3f; + Main.dust[num1452].noGravity = true; + Main.dust[num1452].scale = 2.5f; + num = num1451; + } + } + float[] var_9_48E3C_cp_0 = npc.ai; + int var_9_48E3C_cp_1 = 0; + num244 = var_9_48E3C_cp_0[var_9_48E3C_cp_1]; + var_9_48E3C_cp_0[var_9_48E3C_cp_1] = num244 + 1f; + if (npc.ai[0] >= (float)num1447 && Main.netMode != 1) + { + npc.ai[0] = 0f; + Point point12 = npc.Center.ToTileCoordinates(); + Point point13 = Main.player[npc.target].Center.ToTileCoordinates(); + int num1453 = 20; + int num1454 = 3; + int num1455 = 10; + int num1456 = 1; + int num1457 = 0; + bool flag106 = false; + if (vector251.Length() > 2000f) + { + flag106 = true; + } + while (!flag106 && num1457 < 100) + { + num1457++; + int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); + int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); + if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].nactive()) + { + bool flag107 = true; + if (flag107 && Main.tile[num1458, num1459].lava()) + { + flag107 = false; + } + if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) + { + flag107 = false; + } + if (flag107) + { + npc.ai[2] = (float)num1458; + npc.ai[3] = (float)num1459; + break; + } + } + } + npc.netUpdate = true; + } } - + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } + + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (!Main.hardMode) + { + return 0f; + } + if (spawnInfo.player.GetModPlayer(mod).ZoneAbyssLayer3 && spawnInfo.water) + { + return 0.05f; + } + return spawnInfo.player.ZoneDungeon ? 0.04f : 0f; + } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) @@ -304,27 +300,27 @@ namespace CalamityMod.NPCs.NormalNPCs } } } - + public override void NPCLoot() { if (Main.rand.Next(4) == 0) - { - if (!NPC.LunarApocalypseIsUp) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EidolonTablet")); - } - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticHood); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticRobe); - } - if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(3, 6)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(8, 11)); - if (Main.expertMode && Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(2, 5)); - } - } - } + { + if (!NPC.LunarApocalypseIsUp) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EidolonTablet")); + } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticHood); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.BlueLunaticRobe); + } + if (NPC.downedPlantBoss || CalamityWorld.downedCalamitas) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Ectoplasm, Main.rand.Next(3, 6)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(8, 11)); + if (Main.expertMode && Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Lumenite"), Main.rand.Next(2, 5)); + } + } + } } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index fcb25d3d48..12428b88b1 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -11,40 +11,41 @@ namespace CalamityMod.NPCs.NormalNPCs { public class Horse : ModNPC { - int chargetimer = 0; - int basespeed = 1; - - public override void SetStaticDefaults() + int chargetimer = 0; + int basespeed = 1; + + public override void SetStaticDefaults() { DisplayName.SetDefault("Earth Elemental"); Main.npcFrameCount[npc.type] = 6; } - + public override void SetDefaults() { - npc.npcSlots = 3f; - npc.damage = 50; + npc.npcSlots = 3f; + npc.damage = 50; npc.width = 230; npc.height = 230; npc.defense = 30; - npc.lifeMax = 3800; + npc.lifeMax = 3800; npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - } - npc.knockBackResist = 0f; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 1, 50, 0); npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; - npc.rarity = 2; + npc.rarity = 2; banner = npc.type; bannerItem = mod.ItemType("EarthElementalBanner"); } - + public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.playerSafe || !Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneAbyss || @@ -54,20 +55,20 @@ namespace CalamityMod.NPCs.NormalNPCs } return SpawnCondition.Cavern.Chance * 0.005f; } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter++; - if (npc.frameCounter >= 8) - { - npc.frame.Y = (npc.frame.Y + frameHeight) % (Main.npcFrameCount[npc.type] * frameHeight); - npc.frameCounter = 0; - } - } - - public override void NPCLoot() + + public override void FindFrame(int frameHeight) { - if (Main.rand.Next(3) == 0) + npc.frameCounter++; + if (npc.frameCounter >= 8) + { + npc.frame.Y = (npc.frame.Y + frameHeight) % (Main.npcFrameCount[npc.type] * frameHeight); + npc.frameCounter = 0; + } + } + + public override void NPCLoot() + { + if (Main.rand.Next(3) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("AridArtifact")); } @@ -84,8 +85,8 @@ namespace CalamityMod.NPCs.NormalNPCs Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EarthenPike")); } } - - public override void HitEffect(int hitDirection, double damage) + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { @@ -156,78 +157,78 @@ namespace CalamityMod.NPCs.NormalNPCs } } } - - public override bool PreAI() - { - if (Main.netMode != 1) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= 300f) - { - npc.localAI[0] = 0f; - Main.PlaySound(3, (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)(npc.height / 2)), 41); - npc.TargetClosest(true); - 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 num179 = 4f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = 30; - int num185 = mod.ProjectileType("EarthRockSmall"); - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 4; num186++) - { - num185 = (Main.rand.Next(4) == 0 ? mod.ProjectileType("EarthRockBig") : mod.ProjectileType("EarthRockSmall")); - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = num179 / num183; - num180 += (float)Main.rand.Next(-40, 41); - num182 += (float)Main.rand.Next(-40, 41); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - if ((double)Math.Abs(npc.velocity.X) > 0.2) + + public override bool PreAI() + { + if (Main.netMode != 1) + { + npc.localAI[0] += 1f; + if (npc.localAI[0] >= 300f) + { + npc.localAI[0] = 0f; + Main.PlaySound(3, (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)(npc.height / 2)), 41); + npc.TargetClosest(true); + 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 num179 = 4f; + Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + float num181 = Math.Abs(num180) * 0.1f; + float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; + float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + npc.netUpdate = true; + num183 = num179 / num183; + num180 *= num183; + num182 *= num183; + int num184 = 30; + int num185 = mod.ProjectileType("EarthRockSmall"); + value9.X += num180; + value9.Y += num182; + for (int num186 = 0; num186 < 4; num186++) + { + num185 = (Main.rand.Next(4) == 0 ? mod.ProjectileType("EarthRockBig") : mod.ProjectileType("EarthRockSmall")); + num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; + num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; + num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); + num183 = num179 / num183; + num180 += (float)Main.rand.Next(-40, 41); + num182 += (float)Main.rand.Next(-40, 41); + num180 *= num183; + num182 *= num183; + Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + if ((double)Math.Abs(npc.velocity.X) > 0.2) { npc.spriteDirection = npc.direction; - } - bool expertMode = Main.expertMode; - npc.TargetClosest(true); - Vector2 direction = Main.player[npc.target].Center - npc.Center; - direction.Normalize(); - chargetimer += expertMode ? 2 : 1; - if (chargetimer >= Math.Sqrt(npc.life) * 14.0) - { - if (Main.rand.Next(25) == 1) - { - direction.X = direction.X * 6f; - direction.Y = direction.Y * 6f; - npc.velocity = direction; - chargetimer = 0; - } - } - if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) > basespeed) - { - npc.velocity *= 0.985f; - } - if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) <= basespeed * 1.15) - { - npc.velocity = direction * basespeed; - } - return false; + } + bool expertMode = Main.expertMode; + npc.TargetClosest(true); + Vector2 direction = Main.player[npc.target].Center - npc.Center; + direction.Normalize(); + chargetimer += expertMode ? 2 : 1; + if (chargetimer >= Math.Sqrt(npc.life) * 14.0) + { + if (Main.rand.Next(25) == 1) + { + direction.X = direction.X * 6f; + direction.Y = direction.Y * 6f; + npc.velocity = direction; + chargetimer = 0; + } + } + if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) > basespeed) + { + npc.velocity *= 0.985f; + } + if (Math.Sqrt((npc.velocity.X * npc.velocity.X) + (npc.velocity.Y * npc.velocity.Y)) <= basespeed * 1.15) + { + npc.velocity = direction * basespeed; + } + return false; - } - } + } + } } \ No newline at end of file diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index f492ce9d36..c99e29cee6 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -271,10 +271,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum")); - } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofEleum")); if (Main.rand.Next(10) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FrostBarrier")); diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index a9d6a3b584..b0b8ce8bd4 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -12,257 +12,258 @@ namespace CalamityMod.NPCs.NormalNPCs { public class ImpiousImmolator : ModNPC { - public bool hasBeenHit = false; + public bool hasBeenHit = false; public override void SetStaticDefaults() { DisplayName.SetDefault("Impious Immolator"); - Main.npcFrameCount[npc.type] = 4; - } - + Main.npcFrameCount[npc.type] = 4; + } + public override void SetDefaults() { - npc.noGravity = true; - npc.damage = 0; + npc.noGravity = true; + npc.damage = 0; npc.width = 60; npc.height = 60; npc.defense = 30; npc.lifeMax = 11000; - npc.aiStyle = -1; + npc.aiStyle = -1; aiType = -1; - for (int k = 0; k < npc.buffImmune.Length; k++) - { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - } - npc.value = Item.buyPrice(0, 0, 50, 0); + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.value = Item.buyPrice(0, 0, 50, 0); npc.HitSound = SoundID.NPCHit5; npc.DeathSound = SoundID.NPCDeath7; - npc.knockBackResist = 0.2f; + npc.knockBackResist = 0.2f; banner = npc.type; bannerItem = mod.ItemType("ImpiousImmolatorBanner"); } - public override void AI() - { - npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); - npc.noGravity = true; - if (npc.direction == 0) - { - npc.TargetClosest(true); - } - if (npc.justHit) - { - hasBeenHit = true; - } - npc.chaseable = hasBeenHit; - if (!npc.wet) - { - bool flag14 = hasBeenHit; - npc.TargetClosest(false); - if ((Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) - { - flag14 = false; - } - if (!flag14) - { - if (npc.collideX) - { - npc.velocity.X = npc.velocity.X * -1f; - npc.direction *= -1; - npc.netUpdate = true; - } - if (npc.collideY) - { - npc.netUpdate = true; - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; - npc.directionY = -1; - npc.ai[0] = -1f; - } - else if (npc.velocity.Y < 0f) - { - npc.velocity.Y = Math.Abs(npc.velocity.Y); - npc.directionY = 1; - npc.ai[0] = 1f; - } - } - } - if (flag14) - { - npc.TargetClosest(true); - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.2f; - if (npc.velocity.X > 12f) - { - npc.velocity.X = 12f; - } - if (npc.velocity.X < -12f) - { - npc.velocity.X = -12f; - } - if (npc.velocity.Y > 12f) - { - npc.velocity.Y = 12f; - } - if (npc.velocity.Y < -12f) - { - npc.velocity.Y = -12f; - } - npc.localAI[0] += 1f; - if (Main.netMode != 1 && npc.localAI[0] >= 90f) - { - npc.localAI[0] = 0f; - 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 speed = 12f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); - float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); - num8 = speed / num8; - num6 *= num8; - num7 *= num8; - int damage = 55; - if (Main.expertMode) - { - damage = 42; - } - int beam = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, mod.ProjectileType("FlameBurstHostile"), damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[beam].tileCollide = true; - } - } - } - else - { - npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; - if (npc.velocity.X < -3f || npc.velocity.X > 3f) - { - npc.velocity.X = npc.velocity.X * 0.95f; - } - if (npc.ai[0] == -1f) - { - npc.velocity.Y = npc.velocity.Y - 0.01f; - if ((double)npc.velocity.Y < -0.3) - { - npc.ai[0] = 1f; - } - } - else - { - npc.velocity.Y = npc.velocity.Y + 0.01f; - if ((double)npc.velocity.Y > 0.3) - { - npc.ai[0] = -1f; - } - } - } - int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; - if (Main.tile[num258, num259 - 1] == null) - { - Main.tile[num258, num259 - 1] = new Tile(); - } - if (Main.tile[num258, num259 + 1] == null) - { - Main.tile[num258, num259 + 1] = new Tile(); - } - if (Main.tile[num258, num259 + 2] == null) - { - Main.tile[num258, num259 + 2] = new Tile(); - } - if (Main.tile[num258, num259 - 1].liquid < 128) //problem? - { - if (Main.tile[num258, num259 + 1].active()) - { - npc.ai[0] = -1f; - } - else if (Main.tile[num258, num259 + 2].active()) - { - npc.ai[0] = -1f; - } - } - if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - } - else - { - if (npc.velocity.Y == 0f) - { - npc.velocity.X = npc.velocity.X * 0.94f; - if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) - { - npc.velocity.X = 0f; - } - } - npc.velocity.Y = npc.velocity.Y + 0.3f; - if (npc.velocity.Y > 5f) - { - npc.velocity.Y = 5f; - } - npc.ai[0] = 1f; - } - npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; - if ((double)npc.rotation < -0.1) - { - npc.rotation = -0.1f; - } - if ((double)npc.rotation > 0.1) - { - npc.rotation = 0.1f; - return; - } - } + public override void AI() + { + npc.spriteDirection = ((npc.direction > 0) ? 1 : -1); + npc.noGravity = true; + if (npc.direction == 0) + { + npc.TargetClosest(true); + } + if (npc.justHit) + { + hasBeenHit = true; + } + npc.chaseable = hasBeenHit; + if (!npc.wet) + { + bool flag14 = hasBeenHit; + npc.TargetClosest(false); + if ((Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) + { + flag14 = false; + } + if (!flag14) + { + if (npc.collideX) + { + npc.velocity.X = npc.velocity.X * -1f; + npc.direction *= -1; + npc.netUpdate = true; + } + if (npc.collideY) + { + npc.netUpdate = true; + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y) * -1f; + npc.directionY = -1; + npc.ai[0] = -1f; + } + else if (npc.velocity.Y < 0f) + { + npc.velocity.Y = Math.Abs(npc.velocity.Y); + npc.directionY = 1; + npc.ai[0] = 1f; + } + } + } + if (flag14) + { + npc.TargetClosest(true); + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.2f; + npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * 0.2f; + if (npc.velocity.X > 12f) + { + npc.velocity.X = 12f; + } + if (npc.velocity.X < -12f) + { + npc.velocity.X = -12f; + } + if (npc.velocity.Y > 12f) + { + npc.velocity.Y = 12f; + } + if (npc.velocity.Y < -12f) + { + npc.velocity.Y = -12f; + } + npc.localAI[0] += 1f; + if (Main.netMode != 1 && npc.localAI[0] >= 90f) + { + npc.localAI[0] = 0f; + 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 speed = 12f; + Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num6 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); + float num7 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); + float num8 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); + num8 = speed / num8; + num6 *= num8; + num7 *= num8; + int damage = 55; + if (Main.expertMode) + { + damage = 42; + } + int beam = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, num6, num7, mod.ProjectileType("FlameBurstHostile"), damage, 0f, Main.myPlayer, 0f, 0f); + Main.projectile[beam].tileCollide = true; + } + } + } + else + { + npc.velocity.X = npc.velocity.X + (float)npc.direction * 0.1f; + if (npc.velocity.X < -3f || npc.velocity.X > 3f) + { + npc.velocity.X = npc.velocity.X * 0.95f; + } + if (npc.ai[0] == -1f) + { + npc.velocity.Y = npc.velocity.Y - 0.01f; + if ((double)npc.velocity.Y < -0.3) + { + npc.ai[0] = 1f; + } + } + else + { + npc.velocity.Y = npc.velocity.Y + 0.01f; + if ((double)npc.velocity.Y > 0.3) + { + npc.ai[0] = -1f; + } + } + } + int num258 = (int)(npc.position.X + (float)(npc.width / 2)) / 16; + int num259 = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + if (Main.tile[num258, num259 - 1] == null) + { + Main.tile[num258, num259 - 1] = new Tile(); + } + if (Main.tile[num258, num259 + 1] == null) + { + Main.tile[num258, num259 + 1] = new Tile(); + } + if (Main.tile[num258, num259 + 2] == null) + { + Main.tile[num258, num259 + 2] = new Tile(); + } + if (Main.tile[num258, num259 - 1].liquid < 128) //problem? + { + if (Main.tile[num258, num259 + 1].active()) + { + npc.ai[0] = -1f; + } + else if (Main.tile[num258, num259 + 2].active()) + { + npc.ai[0] = -1f; + } + } + if ((double)npc.velocity.Y > 0.4 || (double)npc.velocity.Y < -0.4) + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + } + else + { + if (npc.velocity.Y == 0f) + { + npc.velocity.X = npc.velocity.X * 0.94f; + if ((double)npc.velocity.X > -0.2 && (double)npc.velocity.X < 0.2) + { + npc.velocity.X = 0f; + } + } + npc.velocity.Y = npc.velocity.Y + 0.3f; + if (npc.velocity.Y > 5f) + { + npc.velocity.Y = 5f; + } + npc.ai[0] = 1f; + } + npc.rotation = npc.velocity.Y * (float)npc.direction * 0.1f; + if ((double)npc.rotation < -0.1) + { + npc.rotation = -0.1f; + } + if ((double)npc.rotation > 0.1) + { + npc.rotation = 0.1f; + return; + } + } - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion) - { - return hasBeenHit; - } - return null; - } + public override bool? CanBeHitByProjectile(Projectile projectile) + { + if (projectile.minion) + { + return hasBeenHit; + } + return null; + } - public override void FindFrame(int frameHeight) - { - npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += (hasBeenHit ? 0.15f : 0.075f); + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedMoonlord) - { - return 0f; - } - if (SpawnCondition.Underworld.Chance > 0f) - { - return SpawnCondition.Underworld.Chance / 4f; - } - return SpawnCondition.OverworldHallow.Chance / 4f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedMoonlord) + { + return 0f; + } + if (SpawnCondition.Underworld.Chance > 0f) + { + return SpawnCondition.Underworld.Chance / 4f; + } + return SpawnCondition.OverworldHallow.Chance / 4f; + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 180, true); - player.AddBuff(mod.BuffType("HolyLight"), 180, true); - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.OnFire, 180, true); + player.AddBuff(mod.BuffType("HolyLight"), 180, true); + } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UnholyEssence"), Main.rand.Next(2, 5)); - if (Main.rand.Next(15) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EnergyStaff")); - } - } + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UnholyEssence"), Main.rand.Next(2, 5)); + if (Main.rand.Next(15) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EnergyStaff")); + } + } - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { diff --git a/NPCs/NormalNPCs/IrradiatedSlime.cs b/NPCs/NormalNPCs/IrradiatedSlime.cs index f2b23b57df..c26256bd7c 100644 --- a/NPCs/NormalNPCs/IrradiatedSlime.cs +++ b/NPCs/NormalNPCs/IrradiatedSlime.cs @@ -17,18 +17,18 @@ namespace CalamityMod.NPCs.NormalNPCs DisplayName.SetDefault("Irradiated Slime"); Main.npcFrameCount[npc.type] = 2; } - + public override void SetDefaults() { npc.aiStyle = 1; - npc.damage = 500; + npc.damage = 50; npc.width = 40; //324 npc.height = 30; //216 npc.defense = 100; - npc.lifeMax = 3000; + npc.lifeMax = 300; npc.knockBackResist = 0f; animationType = 81; - npc.value = Item.buyPrice(0, 0, 30, 0); + npc.value = Item.buyPrice(0, 0, 5, 0); npc.alpha = 50; npc.lavaImmune = false; npc.noGravity = false; @@ -38,34 +38,39 @@ namespace CalamityMod.NPCs.NormalNPCs banner = npc.type; bannerItem = mod.ItemType("IrradiatedSlimeBanner"); } - + + public override void AI() + { + Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.6f, 0.8f, 0.6f); + } + public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || !spawnInfo.player.GetModPlayer(mod).ZoneSulphur || !NPC.downedMoonlord || !Main.raining) + if (spawnInfo.playerSafe || !spawnInfo.player.GetModPlayer(mod).ZoneSulphur || !Main.raining) { return 0f; } return 0.05f; } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/NormalNPCs/IrradiatedSlimeGlow").Width, (float)(mod.GetTexture("NPCs/NormalNPCs/IrradiatedSlimeGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/NormalNPCs/IrradiatedSlimeGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); - } + /*public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/NormalNPCs/IrradiatedSlimeGlow").Width, (float)(mod.GetTexture("NPCs/NormalNPCs/IrradiatedSlimeGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightYellow); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/NormalNPCs/IrradiatedSlimeGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + }*/ - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { @@ -77,9 +82,11 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(npc.position, npc.width, npc.height, 75, hitDirection, -1f, 0, default(Color), 1f); } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/IrradiatedSlime"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/IrradiatedSlime2"), 1f); } } - + public override void NPCLoot() { if (Main.rand.Next(10) == 0) diff --git a/NPCs/NormalNPCs/IrradiatedSlime.png b/NPCs/NormalNPCs/IrradiatedSlime.png index 9618a3c255..fb107ccd0a 100644 Binary files a/NPCs/NormalNPCs/IrradiatedSlime.png and b/NPCs/NormalNPCs/IrradiatedSlime.png differ diff --git a/NPCs/NormalNPCs/IrradiatedSlimeGlow.png b/NPCs/NormalNPCs/IrradiatedSlimeGlow.png deleted file mode 100644 index 6eaad05486..0000000000 Binary files a/NPCs/NormalNPCs/IrradiatedSlimeGlow.png and /dev/null differ diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs new file mode 100644 index 0000000000..7e1cfaeafb --- /dev/null +++ b/NPCs/NormalNPCs/Piggy.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Projectiles; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class Piggy : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Piggy"); + Main.npcFrameCount[npc.type] = 5; + } + + public override void SetDefaults() + { + npc.chaseable = false; + npc.aiStyle = 26; + npc.damage = 0; + npc.width = 26; + npc.height = 26; + npc.defense = 0; + npc.lifeMax = 2000; + npc.aiStyle = 7; + aiType = 299; + npc.knockBackResist = 0.99f; + npc.value = Item.buyPrice(0, 10, 0, 0); + npc.HitSound = SoundID.NPCHit1; + npc.DeathSound = SoundID.NPCDeath1; + /*banner = npc.type; + bannerItem = mod.ItemType("PitbullBanner");*/ + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return SpawnCondition.TownCritter.Chance * 0.01f; + } + + public override void FindFrame(int frameHeight) + { + if (npc.velocity.Y == 0f) + { + if (npc.direction == 1) + { + npc.spriteDirection = -1; + } + if (npc.direction == -1) + { + npc.spriteDirection = 1; + } + if (npc.velocity.X == 0f) + { + npc.frame.Y = 0; + npc.frameCounter = 0.0; + return; + } + npc.frameCounter += (double)(Math.Abs(npc.velocity.X) * 0.25f); + npc.frameCounter += 1.0; + if (npc.frameCounter > 12.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y / frameHeight >= Main.npcFrameCount[npc.type] - 1) + { + npc.frame.Y = frameHeight; + } + } + else + { + npc.frameCounter = 0.0; + npc.frame.Y = frameHeight * 2; + } + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 15; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, hitDirection, -1f, 0, default(Color), 1f); + } + } + } + } +} \ No newline at end of file diff --git a/NPCs/NormalNPCs/Piggy.png b/NPCs/NormalNPCs/Piggy.png new file mode 100644 index 0000000000..dff2a9af97 Binary files /dev/null and b/NPCs/NormalNPCs/Piggy.png differ diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index 4248863da6..306ee931f2 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -17,7 +17,7 @@ namespace CalamityMod.NPCs.NormalNPCs DisplayName.SetDefault("Scorn Eater"); Main.npcFrameCount[npc.type] = 7; } - + public override void SetDefaults() { npc.npcSlots = 3f; @@ -32,8 +32,9 @@ namespace CalamityMod.NPCs.NormalNPCs for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; npc.lavaImmune = true; npc.value = Item.buyPrice(0, 0, 50, 0); npc.HitSound = SoundID.NPCHit23; @@ -41,15 +42,15 @@ namespace CalamityMod.NPCs.NormalNPCs banner = npc.type; bannerItem = mod.ItemType("ScornEaterBanner"); } - + public override void AI() { - if (npc.ai[0] == 0f) + if (npc.ai[0] == 0f) { npc.TargetClosest(true); - if (Main.netMode != 1) + if (Main.netMode != 1) { - if (npc.velocity.X != 0f || npc.velocity.Y < 0f || (double)npc.velocity.Y > 0.9) + if (npc.velocity.X != 0f || npc.velocity.Y < 0f || (double)npc.velocity.Y > 0.9) { npc.ai[0] = 1f; npc.netUpdate = true; @@ -59,108 +60,108 @@ namespace CalamityMod.NPCs.NormalNPCs npc.netUpdate = true; return; } - } - else if (npc.velocity.Y == 0f) + } + else if (npc.velocity.Y == 0f) { npc.ai[2] += 1f; int num321 = 20; - if (npc.ai[1] == 0f) + if (npc.ai[1] == 0f) { num321 = 12; } - if (npc.ai[2] < (float)num321) + if (npc.ai[2] < (float)num321) { npc.velocity.X = npc.velocity.X * 0.9f; return; } npc.ai[2] = 0f; npc.TargetClosest(true); - if (npc.direction == 0) + if (npc.direction == 0) { npc.direction = -1; } npc.spriteDirection = npc.direction; npc.ai[1] += 1f; - npc.ai[3] += 1f; - if (npc.ai[3] >= 4f) - { - npc.ai[3] = 0f; - if (npc.ai[1] == 2f) - { - npc.velocity.X = (float)npc.direction * 15f; - npc.velocity.Y = -12f; - npc.ai[1] = 0f; - } - else - { - npc.velocity.X = (float)npc.direction * 21f; - npc.velocity.Y = -6f; - } - } + npc.ai[3] += 1f; + if (npc.ai[3] >= 4f) + { + npc.ai[3] = 0f; + if (npc.ai[1] == 2f) + { + npc.velocity.X = (float)npc.direction * 15f; + npc.velocity.Y = -12f; + npc.ai[1] = 0f; + } + else + { + npc.velocity.X = (float)npc.direction * 21f; + npc.velocity.Y = -6f; + } + } npc.netUpdate = true; return; } else { - if (npc.direction == 1 && npc.velocity.X < 1f) + if (npc.direction == 1 && npc.velocity.X < 1f) { npc.velocity.X = npc.velocity.X + 0.1f; return; } - if (npc.direction == -1 && npc.velocity.X > -1f) + if (npc.direction == -1 && npc.velocity.X > -1f) { npc.velocity.X = npc.velocity.X - 0.1f; return; } } } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 1.0; - if (Math.Abs(npc.velocity.X) <= 1f) - { - if (npc.frameCounter > 9.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y >= frameHeight * 5) - { - npc.frame.Y = 0; - } - } - else - { - if (npc.frameCounter > 9.0) - { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; - } - if (npc.frame.Y < frameHeight * 5) - { - npc.frame.Y = frameHeight * 5; - } - if (npc.frame.Y >= frameHeight * 7) - { - npc.frame.Y = frameHeight * 5; - } - } - } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedMoonlord) - { - return 0f; - } - if (SpawnCondition.Underworld.Chance > 0f) - { - return SpawnCondition.Underworld.Chance / 4f; - } - return SpawnCondition.OverworldHallow.Chance / 4f; - } - + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 1.0; + if (Math.Abs(npc.velocity.X) <= 1f) + { + if (npc.frameCounter > 9.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = 0; + } + } + else + { + if (npc.frameCounter > 9.0) + { + npc.frame.Y = npc.frame.Y + frameHeight; + npc.frameCounter = 0.0; + } + if (npc.frame.Y < frameHeight * 5) + { + npc.frame.Y = frameHeight * 5; + } + if (npc.frame.Y >= frameHeight * 7) + { + npc.frame.Y = frameHeight * 5; + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedMoonlord) + { + return 0f; + } + if (SpawnCondition.Underworld.Chance > 0f) + { + return SpawnCondition.Underworld.Chance / 4f; + } + return SpawnCondition.OverworldHallow.Chance / 4f; + } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) @@ -173,15 +174,15 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(npc.position, npc.width, npc.height, 244, hitDirection, -1f, 0, default(Color), 1f); } - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater5"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater6"), 1f); - } + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater5"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScornEater6"), 1f); + } } - + public override void NPCLoot() { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UnholyEssence"), Main.rand.Next(2, 5)); diff --git a/NPCs/NormalNPCs/StormlionCharger.cs b/NPCs/NormalNPCs/StormlionCharger.cs index 916cc11cd7..53604acc8f 100644 --- a/NPCs/NormalNPCs/StormlionCharger.cs +++ b/NPCs/NormalNPCs/StormlionCharger.cs @@ -58,7 +58,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - return SpawnCondition.DesertCave.Chance * 0.15f; + return SpawnCondition.DesertCave.Chance * 0.2f; } public override void OnHitPlayer(Player player, int damage, bool crit) diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 46be7c20d9..8fd102085d 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -26,6 +26,12 @@ namespace CalamityMod.NPCs.NormalNPCs npc.height = 100; //216 npc.defense = 40; npc.lifeMax = 6000; + if (CalamityWorld.downedProvidence) + { + npc.damage = 190; + npc.defense = 60; + npc.lifeMax = 30000; + } npc.knockBackResist = 0.05f; npc.value = Item.buyPrice(0, 1, 50, 0); npc.HitSound = SoundID.NPCHit23; @@ -433,6 +439,10 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("EssenceofCinder"), Main.rand.Next(2, 4)); + if (Main.rand.Next(100) == 0 && CalamityWorld.downedProvidence) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Thunderstorm")); + } if (Main.expertMode) { if (Main.rand.Next(3) == 0) diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 7ff9a5b513..57206583d9 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -52,11 +52,11 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) { return 0f; } - return SpawnCondition.OverworldDaySlime.Chance * 0.2f; + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.05f : 0.2f); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/WulfrumSlime.cs b/NPCs/NormalNPCs/WulfrumSlime.cs index 519728e561..a9a4b8d8d0 100644 --- a/NPCs/NormalNPCs/WulfrumSlime.cs +++ b/NPCs/NormalNPCs/WulfrumSlime.cs @@ -41,11 +41,11 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.playerSafe || Main.hardMode || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) + if (spawnInfo.playerSafe || spawnInfo.player.GetModPlayer(mod).ZoneSulphur) { return 0f; } - return SpawnCondition.OverworldDaySlime.Chance * 0.33f; + return SpawnCondition.OverworldDaySlime.Chance * (Main.hardMode ? 0.08f : 0.33f); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 6a09462b12..c6164e75ff 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -24,12 +24,14 @@ namespace CalamityMod.NPCs.Perforator npc.width = 60; //324 npc.height = 60; //216 npc.defense = 12; - npc.lifeMax = 3500; //250000 + npc.lifeMax = 2500; //250000 if (CalamityWorld.bossRushActive) { - npc.lifeMax = CalamityWorld.death ? 1500000 : 1200000; + npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; } - npc.aiStyle = 6; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index bbbce4c823..2597073ae6 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -24,12 +24,14 @@ namespace CalamityMod.NPCs.Perforator npc.width = 54; //324 npc.height = 54; //216 npc.defense = 10; - npc.lifeMax = 3000; //250000 + npc.lifeMax = 2000; //250000 if (CalamityWorld.bossRushActive) { - npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; + npc.lifeMax = CalamityWorld.death ? 900000 : 700000; } - npc.aiStyle = 6; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 48cc57f6fa..4b8d024971 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -24,12 +24,14 @@ namespace CalamityMod.NPCs.Perforator npc.width = 42; //324 npc.height = 42; //216 npc.defense = 8; - npc.lifeMax = 2000; //250000 + npc.lifeMax = 1250; //250000 if (CalamityWorld.bossRushActive) { - npc.lifeMax = CalamityWorld.death ? 800000 : 600000; + npc.lifeMax = CalamityWorld.death ? 600000 : 500000; } - npc.aiStyle = 6; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 361bc4684e..8603257315 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -36,12 +36,14 @@ namespace CalamityMod.NPCs.Perforator npc.width = 70; //324 npc.height = 84; //216 npc.defense = 0; - npc.lifeMax = 3500; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1500000 : 1200000; - } - npc.aiStyle = 6; //new + npc.lifeMax = 2500; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 148418ff6f..fddeeeda1e 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -35,12 +35,14 @@ namespace CalamityMod.NPCs.Perforator npc.width = 58; //324 npc.height = 68; //216 npc.defense = 0; - npc.lifeMax = 3000; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; - } - npc.aiStyle = 6; //new + npc.lifeMax = 2000; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 900000 : 700000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 4e63faf638..b18be58f20 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -35,12 +35,14 @@ namespace CalamityMod.NPCs.Perforator npc.width = 42; //324 npc.height = 62; //216 npc.defense = 0; - npc.lifeMax = 2000; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 800000 : 600000; - } - npc.aiStyle = 6; //new + npc.lifeMax = 1250; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 600000 : 500000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index d2e6414f51..6327fc5cc7 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -31,15 +31,17 @@ namespace CalamityMod.NPCs.Perforator npc.width = 110; //324 npc.height = 100; //216 npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 3594 : 2500; + npc.lifeMax = CalamityWorld.revenge ? 5400 : 3750; if (CalamityWorld.death) { - npc.lifeMax = 5031; + npc.lifeMax = 7600; } if (CalamityWorld.bossRushActive) { - npc.lifeMax = CalamityWorld.death ? 2000000 : 1800000; + npc.lifeMax = CalamityWorld.death ? 3000000 : 2700000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.aiStyle = -1; //new aiType = -1; //new npc.buffImmune[mod.BuffType("GlacialState")] = true; diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index 5f0fbbf0d6..aa06bdcc7e 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -24,12 +24,14 @@ namespace CalamityMod.NPCs.Perforator npc.width = 60; //324 npc.height = 78; //216 npc.defense = 25; - npc.lifeMax = 3500; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1500000 : 1200000; - } - npc.aiStyle = 6; //new + npc.lifeMax = 2500; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 9987db2491..f6cc2c528a 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -24,12 +24,14 @@ namespace CalamityMod.NPCs.Perforator npc.width = 44; //324 npc.height = 58; //216 npc.defense = 22; - npc.lifeMax = 3000; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; - } - npc.aiStyle = 6; //new + npc.lifeMax = 2000; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 900000 : 700000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index bf32322d79..dad30a359c 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -24,12 +24,14 @@ namespace CalamityMod.NPCs.Perforator npc.width = 40; //324 npc.height = 34; //216 npc.defense = 18; - npc.lifeMax = 2000; //250000 - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 800000 : 600000; - } - npc.aiStyle = 6; //new + npc.lifeMax = 1250; //250000 + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 600000 : 500000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs index 25111c231e..b64e877d34 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeG.cs @@ -60,8 +60,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { npc.TargetClosest(true); } - float num = revenge ? 9f : 8f; - float num2 = revenge ? 0.25f : 0.2f; + float num = revenge ? 8f : 7f; + float num2 = revenge ? 0.2f : 0.15f; npc.localAI[0] += 1f; float num3 = (npc.localAI[0] - 60f) / 60f; if (num3 > 1f) diff --git a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs index 6d28e6553a..c245b2b145 100644 --- a/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs +++ b/NPCs/PlaguebringerGoliath/PlagueBeeLargeG.cs @@ -89,7 +89,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float num1258 = Main.player[npc.target].Center.X - vector145.X; float num1259 = Main.player[npc.target].Center.Y - vector145.Y; float num1260 = (float)Math.Sqrt((double)(num1258 * num1258 + num1259 * num1259)); - float num1261 = revenge ? 24f : 22f; + float num1261 = revenge ? 22f : 20f; num1260 = num1261 / num1260; num1258 *= num1260; num1259 *= num1260; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 4b439374e3..36c45239b7 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -48,6 +48,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { npc.lifeMax = CalamityWorld.death ? 4000000 : 3700000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; //new aiType = -1; //new @@ -58,19 +60,19 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; @@ -240,7 +242,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { num1044 += 2f; //2 not a prob } - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1044 += 2f; } @@ -279,7 +281,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath num1048 += 2f; //2 not a prob num1049 += 0.1f; //0.1 not a prob } - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1048 += 2f; num1049 += 0.1f; @@ -336,7 +338,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } npc.spriteDirection = npc.direction; int num1050 = 600; //600 not a prob - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1050 = 250; } @@ -697,7 +699,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Vector2 vector121 = new Vector2(npc.position.X + (float)(npc.width / 2) + (float)(Main.rand.Next(20) * npc.direction), npc.position.Y + (float)npc.height * 0.8f); npc.ai[1] += 1f; bool flag104 = false; - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { if (npc.ai[1] % 10f == 9f) { @@ -728,7 +730,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (Main.netMode != 1) { float projectileSpeed = revenge ? 6.5f : 6f; - if (jungleEnrage || npc.GetGlobalNPC(mod).enraged) + if (jungleEnrage || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { projectileSpeed += 10f; } diff --git a/NPCs/PlaguebringerShade/PlaguebringerShade.cs b/NPCs/PlaguebringerShade/PlaguebringerShade.cs index a37cb4fc1b..dc9b2cb0d3 100644 --- a/NPCs/PlaguebringerShade/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerShade/PlaguebringerShade.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.PlaguebringerShade DisplayName.SetDefault("Plaguebringer"); Main.npcFrameCount[npc.type] = 12; } - + public override void SetDefaults() { npc.damage = 80; //150 @@ -29,32 +29,32 @@ namespace CalamityMod.NPCs.PlaguebringerShade npc.height = 66; //216 npc.defense = 30; npc.lifeMax = CalamityWorld.death ? 4000 : 3000; //250000 - npc.value = Item.buyPrice(0, 1, 50, 0); - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = 200000; - } - npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 1, 50, 0); + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = 200000; + } + npc.knockBackResist = 0f; npc.aiStyle = -1; //new - aiType = -1; //new + aiType = -1; //new animationType = NPCID.QueenBee; for (int k = 0; k < npc.buffImmune.Length; k++) { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - } + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("MarkedforDeath")] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.noGravity = true; npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit4; @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.PlaguebringerShade banner = npc.type; bannerItem = mod.ItemType("PlaguebringerBanner"); } - + public override void AI() { Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.05f, 0.15f, 0.025f); @@ -364,14 +364,14 @@ namespace CalamityMod.NPCs.PlaguebringerShade { num1061 = mod.NPCType("PlagueBeeG"); } - if (NPC.CountNPCS(mod.NPCType("PlagueBeeG")) < 3) - { - int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, num1061, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * 0.005f; - Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.005f; - Main.npc[num1062].localAI[0] = 60f; - Main.npc[num1062].netUpdate = true; - } + if (NPC.CountNPCS(mod.NPCType("PlagueBeeG")) < 3) + { + int num1062 = NPC.NewNPC((int)vector119.X, (int)vector119.Y, num1061, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num1062].velocity.X = (float)Main.rand.Next(-200, 201) * 0.005f; + Main.npc[num1062].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.005f; + Main.npc[num1062].localAI[0] = 60f; + Main.npc[num1062].netUpdate = true; + } } } if (num1060 > 400f || !Collision.CanHit(new Vector2(vector119.X, vector119.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) @@ -472,10 +472,10 @@ namespace CalamityMod.NPCs.PlaguebringerShade num1074 = 25; num1075 = mod.ProjectileType("HiveBombGoliath"); } - if (CalamityWorld.death) - { - num1074 += 20; - } + if (CalamityWorld.death) + { + num1074 += 20; + } int num1076 = Projectile.NewProjectile(vector121.X, vector121.Y, num1071, num1072, num1075, num1074, 0f, Main.myPlayer, 0f, 0f); Main.projectile[num1076].timeLeft = 300; } @@ -570,16 +570,16 @@ namespace CalamityMod.NPCs.PlaguebringerShade } } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !NPC.downedGolemBoss) - { - return 0f; - } - return SpawnCondition.HardmodeJungle.Chance * 0.02f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !NPC.downedGolemBoss) + { + return 0f; + } + return SpawnCondition.HardmodeJungle.Chance * 0.02f; + } - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { @@ -587,12 +587,12 @@ namespace CalamityMod.NPCs.PlaguebringerShade } if (npc.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg5"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg4"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Pbg5"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); npc.position.Y = npc.position.Y + (float)(npc.height / 2); npc.width = 100; npc.height = 100; @@ -619,11 +619,11 @@ namespace CalamityMod.NPCs.PlaguebringerShade } } - public override void NPCLoot() - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(8, 13)); - } - + public override void NPCLoot() + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("PlagueCellCluster"), Main.rand.Next(8, 13)); + } + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(mod.BuffType("Plague"), 120, true); diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 2cd5e27ea4..1e490c80aa 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -36,21 +36,23 @@ namespace CalamityMod.NPCs.Polterghast { npc.lifeMax = CalamityWorld.death ? 1100000 : 900000; } - npc.knockBackResist = 0f; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; npc.aiStyle = -1; //new aiType = -1; //new npc.alpha = 255; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; npc.noGravity = true; npc.noTileCollide = true; npc.netAlways = true; @@ -75,10 +77,16 @@ namespace CalamityMod.NPCs.Polterghast Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 0.25f, 0.75f); npc.TargetClosest(true); Vector2 vector = npc.Center; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 6000f) { npc.active = false; } + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 6000f) + { + npc.active = false; + } bool speedBoost1 = false; bool despawnBoost = false; - if (npc.timeLeft < 1500) { npc.timeLeft = 1500; } + if (npc.timeLeft < 1500) + { + npc.timeLeft = 1500; + } bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); int[] array2 = new int[4]; @@ -94,7 +102,8 @@ namespace CalamityMod.NPCs.Polterghast num731 += Main.npc[num733].Center.Y; array2[num732] = num733; num732++; - if (num732 > 3) { break; } + if (num732 > 3) + break; } num = num733; } @@ -105,12 +114,16 @@ namespace CalamityMod.NPCs.Polterghast if (!Main.player[npc.target].ZoneDungeon) { despawnTimer--; - if (despawnTimer <= 0) { despawnBoost = true; } + if (despawnTimer <= 0) + despawnBoost = true; speedBoost1 = true; num734 += 8f; num735 = 0.15f; } - else { despawnTimer = 600; } + else + { + despawnTimer = 600; + } if (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] < 300f) { num734 = 18f; @@ -134,8 +147,14 @@ namespace CalamityMod.NPCs.Polterghast } float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); int num739 = 500; - if (speedBoost1) { num739 += 500; } - if (expertMode) { num739 += 150; } + if (speedBoost1) + { + num739 += 500; + } + if (expertMode) + { + num739 += 150; + } if (num738 >= (float)num739) { num738 = (float)num739 / num738; @@ -198,13 +217,13 @@ namespace CalamityMod.NPCs.Polterghast if (speedBoost1) { npc.defense = 400; - npc.damage = 1200; + npc.damage = 1200; } else { npc.damage = expertMode ? 336 : 210; npc.defense = 0; - } + } } public override Color? GetAlpha(Color drawColor) diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index d1f01208b2..1df4fb7e75 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -40,6 +40,8 @@ namespace CalamityMod.NPCs.Polterghast { npc.lifeMax = CalamityWorld.death ? 2800000 : 2500000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; //new aiType = -1; //new @@ -48,14 +50,14 @@ namespace CalamityMod.NPCs.Polterghast for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; npc.noGravity = true; npc.noTileCollide = true; npc.netAlways = true; @@ -74,15 +76,22 @@ namespace CalamityMod.NPCs.Polterghast if (Main.raining) { Main.raining = false; - if (Main.netMode == 2) { NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); } + if (Main.netMode == 2) + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); } Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.5f, 1.25f, 1.25f); npc.TargetClosest(true); Vector2 vector = npc.Center; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 6000f) { npc.active = false; } + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 6000f) + { + npc.active = false; + } bool speedBoost1 = false; bool despawnBoost = false; - if (npc.timeLeft < 1500) { npc.timeLeft = 1500; } + if (npc.timeLeft < 1500) + { + npc.timeLeft = 1500; + } bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.75; //hooks detach and fire beams @@ -111,7 +120,8 @@ namespace CalamityMod.NPCs.Polterghast num731 += Main.npc[num733].Center.Y; array2[num732] = num733; num732++; - if (num732 > 3) { break; } + if (num732 > 3) + break; } num = num733; } @@ -122,12 +132,16 @@ namespace CalamityMod.NPCs.Polterghast if (!Main.player[npc.target].ZoneDungeon && !CalamityWorld.bossRushActive) { despawnTimer--; - if (despawnTimer <= 0) { despawnBoost = true; } + if (despawnTimer <= 0) + despawnBoost = true; speedBoost1 = true; num734 += 8f; num735 = 0.15f; } - else { despawnTimer = 600; } + else + { + despawnTimer = 600; + } if (phase2) { num734 = 3.5f; @@ -223,8 +237,14 @@ namespace CalamityMod.NPCs.Polterghast } float num738 = (float)Math.Sqrt((double)(num736 * num736 + num737 * num737)); int num739 = 500; - if (speedBoost1) { num739 += 500; } - if (expertMode) { num739 += 150; } + if (speedBoost1) + { + num739 += 500; + } + if (expertMode) + { + num739 += 150; + } if (num738 >= (float)num739) { num738 = (float)num739 / num738; @@ -327,12 +347,12 @@ namespace CalamityMod.NPCs.Polterghast if (flag47) { Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = 11f; + float num742 = 6f; if (expertMode) { - num742 = (CalamityWorld.bossRushActive ? 18f : 12f); + num742 = (CalamityWorld.bossRushActive ? 13f : 7f); } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num742 *= 2f; } @@ -355,14 +375,14 @@ namespace CalamityMod.NPCs.Polterghast npc.localAI[1] = -30f; num747 = mod.ProjectileType("PhantomBlast"); } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num746 *= 2; } vector93.X += num743 * 3f; vector93.Y += num744 * 3f; int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num748].timeLeft = 300; + Main.projectile[num748].timeLeft = (num747 == mod.ProjectileType("PhantomBlast") ? 300 : 1200); return; } else @@ -373,7 +393,7 @@ namespace CalamityMod.NPCs.Polterghast { num742 = (CalamityWorld.bossRushActive ? 18f : 12f); } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num742 *= 2f; } @@ -385,7 +405,7 @@ namespace CalamityMod.NPCs.Polterghast num744 *= num745; int num746 = expertMode ? 51 : 60; int num747 = mod.ProjectileType("PhantomBlast"); - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num746 *= 2; } @@ -430,7 +450,7 @@ namespace CalamityMod.NPCs.Polterghast } } npc.GivenName = "Necroghast"; - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { npc.defense = 200; npc.damage = (int)(300f * Main.damageMultiplier); @@ -463,12 +483,12 @@ namespace CalamityMod.NPCs.Polterghast if (flag47) { Vector2 vector93 = new Vector2(vector.X, vector.Y); - float num742 = 11f; + float num742 = 6f; if (expertMode) { - num742 = (CalamityWorld.bossRushActive ? 18f : 12f); + num742 = (CalamityWorld.bossRushActive ? 13f : 7f); } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num742 *= 2f; } @@ -491,14 +511,14 @@ namespace CalamityMod.NPCs.Polterghast npc.localAI[1] = -30f; num747 = mod.ProjectileType("PhantomBlast2"); } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num746 *= 2; } vector93.X += num743 * 3f; vector93.Y += num744 * 3f; int num748 = Projectile.NewProjectile(vector93.X, vector93.Y, num743, num744, num747, num746, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[num748].timeLeft = 400; + Main.projectile[num748].timeLeft = (num747 == mod.ProjectileType("PhantomBlast2") ? 300 : 1200); return; } else @@ -509,7 +529,7 @@ namespace CalamityMod.NPCs.Polterghast { num742 = (CalamityWorld.bossRushActive ? 18f : 12f); } - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num742 *= 2f; } @@ -521,7 +541,7 @@ namespace CalamityMod.NPCs.Polterghast num744 *= num745; int num746 = expertMode ? 54 : 65; int num747 = mod.ProjectileType("PhantomBlast2"); - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num746 *= 2; } @@ -579,7 +599,7 @@ namespace CalamityMod.NPCs.Polterghast } } npc.GivenName = "Necroplasm"; - if (speedBoost1 || npc.GetGlobalNPC(mod).enraged) + if (speedBoost1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { npc.defense = 200; npc.damage = (int)(400f * Main.damageMultiplier); diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs index a0858bd971..13db682bde 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs @@ -36,7 +36,9 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss { npc.lifeMax = CalamityWorld.death ? 600000 : 500000; } - npc.knockBackResist = 0f; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; aiType = -1; @@ -51,17 +53,17 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.value = Item.buyPrice(0, 25, 0, 0); npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; @@ -325,7 +327,7 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss npc.velocity /= 2f; npc.netUpdate = true; npc.ai[1] = 45f; - npc.ai[0] = 4f; + npc.ai[0] = 3f; } else { @@ -340,16 +342,16 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; } } - else if (npc.ai[0] == 4f) + else if (npc.ai[0] == 3f) { - npc.ai[1] -= 3f; + npc.ai[1] -= 1f; if (npc.ai[1] <= 0f) { npc.ai[0] = 0f; npc.ai[1] = 0f; npc.netUpdate = true; } - npc.velocity *= 0.95f; + npc.velocity *= 0.98f; } } diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs index bf174a4502..24b38b0a18 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs @@ -33,7 +33,9 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss { npc.lifeMax = CalamityWorld.death ? 400000 : 300000; } - npc.knockBackResist = 0f; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; @@ -47,17 +49,17 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; } diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs index a3a845bd01..58bc05bbcd 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs @@ -33,7 +33,9 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss { npc.lifeMax = CalamityWorld.death ? 240000 : 200000; } - npc.knockBackResist = 0f; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; @@ -47,17 +49,17 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; } diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 9d64831c5d..2d3f53aab9 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -31,24 +31,26 @@ namespace CalamityMod.NPCs.Providence { npc.lifeMax = CalamityWorld.death ? 360000 : 300000; } - npc.knockBackResist = 0f; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; aiType = -1; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; } diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index 7f1350a4d0..2e3f5b414c 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -31,24 +31,26 @@ namespace CalamityMod.NPCs.Providence { npc.lifeMax = CalamityWorld.death ? 500000 : 400000; } - npc.knockBackResist = 0f; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; aiType = -1; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; } diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 0938d0da82..b8aa3a5720 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -33,7 +33,9 @@ namespace CalamityMod.NPCs.Providence { npc.lifeMax = CalamityWorld.death ? 500000 : 400000; } - npc.knockBackResist = 0f; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; aiType = -1; @@ -42,17 +44,17 @@ namespace CalamityMod.NPCs.Providence for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; } @@ -230,7 +232,7 @@ namespace CalamityMod.NPCs.Providence npc.velocity /= 2f; npc.netUpdate = true; npc.ai[1] = 45f; - npc.ai[0] = 4f; + npc.ai[0] = 3f; } else { @@ -245,16 +247,16 @@ namespace CalamityMod.NPCs.Providence npc.velocity = (npc.velocity * (num1005 - 1f) + vec2 * (npc.velocity.Length() + num1006)) / num1005; } } - else if (npc.ai[0] == 4f) + else if (npc.ai[0] == 3f) { - npc.ai[1] -= 3f; + npc.ai[1] -= 1f; if (npc.ai[1] <= 0f) { npc.ai[0] = 0f; npc.ai[1] = 0f; npc.netUpdate = true; } - npc.velocity *= 0.95f; + npc.velocity *= 0.98f; } } diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index abf5b64f2d..d8b1d160fb 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -44,6 +44,8 @@ namespace CalamityMod.NPCs.Providence { npc.lifeMax = CalamityWorld.death ? 15000000 : 12500000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; //new aiType = -1; //new @@ -52,17 +54,17 @@ namespace CalamityMod.NPCs.Providence for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.noGravity = true; npc.noTileCollide = true; npc.netAlways = true; @@ -109,6 +111,7 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode == 2) NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); } + int guardianAmt = NPC.CountNPCS(mod.NPCType("ProvSpawnOffense")) + NPC.CountNPCS(mod.NPCType("ProvSpawnDefense")) + NPC.CountNPCS(mod.NPCType("ProvSpawnHealer")); if (NPC.CountNPCS(mod.NPCType("ProvSpawnHealer")) > 0) { float heal = revenge ? 90f : 120f; @@ -116,6 +119,17 @@ namespace CalamityMod.NPCs.Providence { heal = 30f; } + switch (guardianAmt) + { + case 1: + heal *= 2f; + break; + case 2: + break; + case 3: + heal *= 0.5f; + break; + } healTimer++; if (healTimer >= heal) { @@ -192,9 +206,7 @@ namespace CalamityMod.NPCs.Providence } } } - if (NPC.CountNPCS(mod.NPCType("ProvSpawnOffense")) > 0 || - NPC.CountNPCS(mod.NPCType("ProvSpawnDefense")) > 0 || - NPC.CountNPCS(mod.NPCType("ProvSpawnHealer")) > 0) + if (guardianAmt > 0) { canAttack = attackMore; } @@ -289,7 +301,7 @@ namespace CalamityMod.NPCs.Providence { num856 = expertMode ? 23 : 24; } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || npc.GetGlobalNPC(mod).enraged) + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num856 = expertMode ? 21 : 22; } @@ -314,7 +326,7 @@ namespace CalamityMod.NPCs.Providence { num860 = expertMode ? 11.5f : 10f; } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || npc.GetGlobalNPC(mod).enraged) + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num860 = expertMode ? 12.75f : 11f; } @@ -547,7 +559,7 @@ namespace CalamityMod.NPCs.Providence { num864 = expertMode ? 64 : 70; } - if ((double)npc.life <= (double)npc.lifeMax * 0.1 || npc.GetGlobalNPC(mod).enraged) + if ((double)npc.life <= (double)npc.lifeMax * 0.1 || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num864 = expertMode ? 56 : 64; } @@ -591,7 +603,7 @@ namespace CalamityMod.NPCs.Providence npc.velocity *= 0.95f; if (Main.netMode != 1) { - npc.ai[2] += (npc.GetGlobalNPC(mod).enraged ? 2f : 1f); + npc.ai[2] += ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); if ((double)npc.life < (double)npc.lifeMax * 0.5 || CalamityWorld.bossRushActive) { npc.ai[2] += 1f; @@ -918,6 +930,10 @@ namespace CalamityMod.NPCs.Providence { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ProvidenceMask")); } + if (Main.rand.Next(40) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SamuraiBadge")); + } if (Main.rand.Next(4) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BlissfulBombardier")); diff --git a/NPCs/Scavenger/ScavengerBody.cs b/NPCs/Scavenger/ScavengerBody.cs index f0a87a5ebe..8ddd648697 100644 --- a/NPCs/Scavenger/ScavengerBody.cs +++ b/NPCs/Scavenger/ScavengerBody.cs @@ -10,15 +10,15 @@ using CalamityMod.Projectiles; namespace CalamityMod.NPCs.Scavenger { - [AutoloadBossHead] - public class ScavengerBody : ModNPC + [AutoloadBossHead] + public class ScavengerBody : ModNPC { public override void SetStaticDefaults() { DisplayName.SetDefault("Ravager"); Main.npcFrameCount[npc.type] = 7; } - + public override void SetDefaults() { npc.npcSlots = 20f; @@ -28,59 +28,61 @@ namespace CalamityMod.NPCs.Scavenger npc.height = 214; //216 npc.defense = 80; npc.lifeMax = CalamityWorld.revenge ? 53500 : 42700; - if (CalamityWorld.death) - { - npc.lifeMax = 90000; - } - npc.knockBackResist = 0f; + if (CalamityWorld.death) + { + npc.lifeMax = 90000; + } + npc.knockBackResist = 0f; aiType = -1; for (int k = 0; k < npc.buffImmune.Length; k++) { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - } + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.boss = true; npc.alpha = 255; npc.value = Item.buyPrice(0, 25, 0, 0); npc.HitSound = SoundID.NPCHit41; npc.DeathSound = SoundID.NPCDeath14; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Ravager"); - else - music = MusicID.Boss4; - bossBag = mod.ItemType("RavagerBag"); - if (CalamityWorld.downedProvidence) + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Ravager"); + else + music = MusicID.Boss4; + bossBag = mod.ItemType("RavagerBag"); + if (CalamityWorld.downedProvidence) { npc.defense = 180; npc.lifeMax = 350000; npc.value = Item.buyPrice(0, 35, 0, 0); } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 2300000 : 2100000; - } - } - + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 2300000 : 2100000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } + public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + public override void AI() { bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); @@ -88,7 +90,7 @@ namespace CalamityMod.NPCs.Scavenger Lighting.AddLight((int)(npc.position.X - 100f) / 16, (int)(npc.position.Y - 20f) / 16, 0f, 0.51f, 2f); Lighting.AddLight((int)(npc.position.X + 100f) / 16, (int)(npc.position.Y - 20f) / 16, 0f, 0.51f, 2f); CalamityGlobalNPC.scavenger = npc.whoAmI; - if (npc.localAI[0] == 0f && Main.netMode != 1) + if (npc.localAI[0] == 0f && Main.netMode != 1) { npc.localAI[0] = 1f; NPC.NewNPC((int)npc.Center.X - 70, (int)npc.Center.Y + 88, mod.NPCType("ScavengerLegLeft"), 0, 0f, 0f, 0f, 0f, 255); @@ -96,7 +98,7 @@ namespace CalamityMod.NPCs.Scavenger NPC.NewNPC((int)npc.Center.X - 120, (int)npc.Center.Y + 50, mod.NPCType("ScavengerClawLeft"), 0, 0f, 0f, 0f, 0f, 255); NPC.NewNPC((int)npc.Center.X + 120, (int)npc.Center.Y + 50, mod.NPCType("ScavengerClawRight"), 0, 0f, 0f, 0f, 0f, 255); NPC.NewNPC((int)npc.Center.X + 1, (int)npc.Center.Y - 20, mod.NPCType("ScavengerHead"), 0, 0f, 0f, 0f, 0f, 255); - } + } if (npc.target >= 0 && Main.player[npc.target].dead) { npc.TargetClosest(true); @@ -105,10 +107,10 @@ namespace CalamityMod.NPCs.Scavenger npc.noTileCollide = true; } } - if (npc.alpha > 0) + if (npc.alpha > 0) { npc.alpha -= 10; - if (npc.alpha < 0) + if (npc.alpha < 0) { npc.alpha = 0; } @@ -119,50 +121,50 @@ namespace CalamityMod.NPCs.Scavenger bool headActive = false; bool rightClawActive = false; bool leftClawActive = false; - for (int num619 = 0; num619 < 200; num619++) + for (int num619 = 0; num619 < 200; num619++) { - if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerHead")) + if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerHead")) { headActive = true; } - if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerClawRight")) + if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerClawRight")) { rightClawActive = true; } - if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerClawLeft")) + if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerClawLeft")) { leftClawActive = true; } - if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerLegRight")) + if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerLegRight")) { rightLegActive = true; } - if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerLegLeft")) + if (Main.npc[num619].active && Main.npc[num619].type == mod.NPCType("ScavengerLegLeft")) { leftLegActive = true; } } - bool enrage = false; - if (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) > npc.position.Y + (float)(npc.height / 2) + 10f) - { - enrage = true; - } - if (headActive || rightClawActive || leftClawActive || rightLegActive || leftLegActive) + bool enrage = false; + if (Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) > npc.position.Y + (float)(npc.height / 2) + 10f) + { + enrage = true; + } + if (headActive || rightClawActive || leftClawActive || rightLegActive || leftLegActive) { npc.dontTakeDamage = true; } else { npc.dontTakeDamage = false; - if (Main.netMode != 2) - { - if (!Main.player[npc.target].dead && Main.player[npc.target].active) - { - Main.player[npc.target].AddBuff(mod.BuffType("WeakPetrification"), 2); - } - } - } - if (!headActive) + if (Main.netMode != 2) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active) + { + Main.player[Main.myPlayer].AddBuff(mod.BuffType("WeakPetrification"), 2); + } + } + } + if (!headActive) { int rightDust = Dust.NewDust(new Vector2(npc.Center.X, npc.Center.Y - 30f), 8, 8, 5, 0f, 0f, 100, default(Color), 2.5f); Main.dust[rightDust].alpha += Main.rand.Next(100); @@ -170,10 +172,10 @@ namespace CalamityMod.NPCs.Scavenger Dust rightDustExpr = Main.dust[rightDust]; rightDustExpr.velocity.Y = rightDustExpr.velocity.Y - (3f + (float)Main.rand.Next(10) * 0.1f); Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - if (Main.rand.Next(10) == 0) + if (Main.rand.Next(10) == 0) { rightDust = Dust.NewDust(new Vector2(npc.Center.X, npc.Center.Y - 30f), 8, 8, 6, 0f, 0f, 0, default(Color), 1.5f); - if (Main.rand.Next(20) != 0) + if (Main.rand.Next(20) != 0) { Main.dust[rightDust].noGravity = true; Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; @@ -192,22 +194,22 @@ namespace CalamityMod.NPCs.Scavenger { Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - int laserDamage = expertMode ? 34 : 48; - for (i = 0; i < 4; i++ ) - { - offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)( Math.Sin(offsetAngle) * 7f ), (float)( Math.Cos(offsetAngle) * 7f ), 259, laserDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)( -Math.Sin(offsetAngle) * 7f ), (float)( -Math.Cos(offsetAngle) * 7f ), 259, laserDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - } + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + int laserDamage = expertMode ? 34 : 48; + for (i = 0; i < 4; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(Math.Sin(offsetAngle) * 7f), (float)(Math.Cos(offsetAngle) * 7f), 259, laserDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, (float)(-Math.Sin(offsetAngle) * 7f), (float)(-Math.Cos(offsetAngle) * 7f), 259, laserDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + } } } - } + } } - if (!rightClawActive) + if (!rightClawActive) { int rightDust = Dust.NewDust(new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f), 8, 8, 5, 0f, 0f, 100, default(Color), 3f); Main.dust[rightDust].alpha += Main.rand.Next(100); @@ -215,10 +217,10 @@ namespace CalamityMod.NPCs.Scavenger Dust rightDustExpr = Main.dust[rightDust]; rightDustExpr.velocity.X = rightDustExpr.velocity.X + (3f + (float)Main.rand.Next(10) * 0.1f); Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - if (Main.rand.Next(10) == 0) + if (Main.rand.Next(10) == 0) { rightDust = Dust.NewDust(new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f), 8, 8, 6, 0f, 0f, 0, default(Color), 2f); - if (Main.rand.Next(20) != 0) + if (Main.rand.Next(20) != 0) { Main.dust[rightDust].noGravity = true; Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; @@ -234,12 +236,12 @@ namespace CalamityMod.NPCs.Scavenger Main.PlaySound(SoundID.Item20, npc.position); npc.localAI[2] = 0f; Vector2 shootFromVector = new Vector2(npc.Center.X + 80f, npc.Center.Y + 45f); - int damage = expertMode ? 28 : 40; - int laser = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, 12f, 0f, 258, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + int damage = expertMode ? 28 : 40; + int laser = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, 12f, 0f, 258, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); } } } - if (!leftClawActive) + if (!leftClawActive) { int leftDust = Dust.NewDust(new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f), 8, 8, 5, 0f, 0f, 100, default(Color), 3f); Main.dust[leftDust].alpha += Main.rand.Next(100); @@ -266,12 +268,12 @@ namespace CalamityMod.NPCs.Scavenger Main.PlaySound(SoundID.Item20, npc.position); npc.localAI[3] = 0f; Vector2 shootFromVector = new Vector2(npc.Center.X - 80f, npc.Center.Y + 45f); - int damage = expertMode ? 28 : 40; - int laser = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, -12f, 0f, 258, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + int damage = expertMode ? 28 : 40; + int laser = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, -12f, 0f, 258, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); } } } - if (!rightLegActive) + if (!rightLegActive) { int rightDust = Dust.NewDust(new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f), 8, 8, 5, 0f, 0f, 100, default(Color), 2f); Main.dust[rightDust].alpha += Main.rand.Next(100); @@ -279,10 +281,10 @@ namespace CalamityMod.NPCs.Scavenger Dust rightDustExpr = Main.dust[rightDust]; rightDustExpr.velocity.Y = rightDustExpr.velocity.Y + (0.5f + (float)Main.rand.Next(10) * 0.1f); Main.dust[rightDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - if (Main.rand.Next(10) == 0) + if (Main.rand.Next(10) == 0) { rightDust = Dust.NewDust(new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f), 8, 8, 6, 0f, 0f, 0, default(Color), 1.5f); - if (Main.rand.Next(20) != 0) + if (Main.rand.Next(20) != 0) { Main.dust[rightDust].noGravity = true; Main.dust[rightDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; @@ -297,13 +299,13 @@ namespace CalamityMod.NPCs.Scavenger { npc.ai[2] = 0f; Vector2 shootFromVector = new Vector2(npc.Center.X + 60f, npc.Center.Y + 60f); - int damage = expertMode ? 28 : 40; - int fire = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, 0f, 2f, 326 + Main.rand.Next(3), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + int damage = expertMode ? 28 : 40; + int fire = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, 0f, 2f, 326 + Main.rand.Next(3), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); Main.projectile[fire].timeLeft = 180; } } } - if (!leftLegActive) + if (!leftLegActive) { int leftDust = Dust.NewDust(new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f), 8, 8, 5, 0f, 0f, 100, default(Color), 2f); Main.dust[leftDust].alpha += Main.rand.Next(100); @@ -311,10 +313,10 @@ namespace CalamityMod.NPCs.Scavenger Dust leftDustExpr = Main.dust[leftDust]; leftDustExpr.velocity.Y = leftDustExpr.velocity.Y + (0.5f + (float)Main.rand.Next(10) * 0.1f); Main.dust[leftDust].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - if (Main.rand.Next(10) == 0) + if (Main.rand.Next(10) == 0) { leftDust = Dust.NewDust(new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f), 8, 8, 6, 0f, 0f, 0, default(Color), 1.5f); - if (Main.rand.Next(20) != 0) + if (Main.rand.Next(20) != 0) { Main.dust[leftDust].noGravity = true; Main.dust[leftDust].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; @@ -329,71 +331,71 @@ namespace CalamityMod.NPCs.Scavenger { npc.ai[3] = 0f; Vector2 shootFromVector = new Vector2(npc.Center.X - 60f, npc.Center.Y + 60f); - int damage = expertMode ? 28 : 40; - int fire = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, 0f, 2f, 326 + Main.rand.Next(3), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + int damage = expertMode ? 28 : 40; + int fire = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, 0f, 2f, 326 + Main.rand.Next(3), damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); Main.projectile[fire].timeLeft = 180; } } } - if (npc.ai[0] == 0f) + if (npc.ai[0] == 0f) { npc.noTileCollide = false; - if (npc.velocity.Y == 0f) + if (npc.velocity.Y == 0f) { npc.velocity.X = npc.velocity.X * 0.8f; npc.ai[1] += 1f; - if (npc.ai[1] > 0f) + if (npc.ai[1] > 0f) { - if ((!rightClawActive && !leftClawActive) || npc.GetGlobalNPC(mod).enraged) + if ((!rightClawActive && !leftClawActive) || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { npc.ai[1] += 1f; } - if (!headActive || npc.GetGlobalNPC(mod).enraged) + if (!headActive || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { npc.ai[1] += 1f; } - if ((!rightLegActive && !leftLegActive) || npc.GetGlobalNPC(mod).enraged) + if ((!rightLegActive && !leftLegActive) || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { npc.ai[1] += 1f; } } - if (npc.ai[1] >= 300f) + if (npc.ai[1] >= 300f) { npc.ai[1] = -20f; - } + } else if (npc.ai[1] == -1f) { npc.TargetClosest(true); - int speedXMult = ((enrage || npc.GetGlobalNPC(mod).enraged) ? 8 : 4); + int speedXMult = ((enrage || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 8 : 4); npc.velocity.X = (float)(speedXMult * npc.direction); npc.velocity.Y = -15.2f; npc.ai[0] = 1f; npc.ai[1] = 0f; } } - } - else if (npc.ai[0] == 1f) + } + else if (npc.ai[0] == 1f) { - if (npc.velocity.Y == 0f) + if (npc.velocity.Y == 0f) { Main.PlaySound(SoundID.Item14, npc.position); npc.ai[0] = 0f; - if (Main.netMode != 1) - { - if (NPC.CountNPCS(mod.NPCType("RockPillar")) < 2) - { - NPC.NewNPC((int)npc.Center.X - 360, (int)npc.Center.Y - 10, mod.NPCType("RockPillar"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)npc.Center.X + 360, (int)npc.Center.Y - 10, mod.NPCType("RockPillar"), 0, 0f, 0f, 0f, 0f, 255); - } - if (NPC.CountNPCS(mod.NPCType("FlamePillar")) < 2) - { - NPC.NewNPC((int)Main.player[npc.target].Center.X - 180, (int)Main.player[npc.target].Center.Y - 10, mod.NPCType("FlamePillar"), 0, 0f, 0f, 0f, 0f, 255); - NPC.NewNPC((int)Main.player[npc.target].Center.X + 180, (int)Main.player[npc.target].Center.Y - 10, mod.NPCType("FlamePillar"), 0, 0f, 0f, 0f, 0f, 255); - } - } - for (int stompDustArea = (int)npc.position.X - 30; stompDustArea < (int)npc.position.X + npc.width + 60; stompDustArea += 30) + if (Main.netMode != 1) { - for (int stompDustAmount = 0; stompDustAmount < 6; stompDustAmount++) + if (NPC.CountNPCS(mod.NPCType("RockPillar")) < 2) + { + NPC.NewNPC((int)npc.Center.X - 360, (int)npc.Center.Y - 10, mod.NPCType("RockPillar"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X + 360, (int)npc.Center.Y - 10, mod.NPCType("RockPillar"), 0, 0f, 0f, 0f, 0f, 255); + } + if (NPC.CountNPCS(mod.NPCType("FlamePillar")) < 2) + { + NPC.NewNPC((int)Main.player[npc.target].Center.X - 180, (int)Main.player[npc.target].Center.Y - 10, mod.NPCType("FlamePillar"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)Main.player[npc.target].Center.X + 180, (int)Main.player[npc.target].Center.Y - 10, mod.NPCType("FlamePillar"), 0, 0f, 0f, 0f, 0f, 255); + } + } + for (int stompDustArea = (int)npc.position.X - 30; stompDustArea < (int)npc.position.X + npc.width + 60; stompDustArea += 30) + { + for (int stompDustAmount = 0; stompDustAmount < 6; stompDustAmount++) { int stompDust = Dust.NewDust(new Vector2(npc.position.X - 30f, npc.position.Y + (float)npc.height), npc.width + 30, 4, 31, 0f, 0f, 100, default(Color), 1.5f); Main.dust[stompDust].velocity *= 0.2f; @@ -401,55 +403,55 @@ namespace CalamityMod.NPCs.Scavenger int stompGore = Gore.NewGore(new Vector2((float)(stompDustArea - 30), npc.position.Y + (float)npc.height - 12f), default(Vector2), Main.rand.Next(61, 64), 1f); Main.gore[stompGore].velocity *= 0.4f; } - } - else + } + else { npc.TargetClosest(true); - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width) { npc.velocity.X = npc.velocity.X * 0.9f; npc.velocity.Y = npc.velocity.Y + 0.2f; - } + } else { - if (npc.direction < 0) + if (npc.direction < 0) { npc.velocity.X = npc.velocity.X - 0.2f; - } + } else if (npc.direction > 0) { npc.velocity.X = npc.velocity.X + 0.2f; } float velocityX = 3f; - if (npc.GetGlobalNPC(mod).enraged) - { - velocityX += 3f; - } - if (!rightClawActive) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) + { + velocityX += 3f; + } + if (!rightClawActive) { velocityX += 1f; } - if (!leftClawActive) + if (!leftClawActive) { velocityX += 1f; } - if (!headActive) + if (!headActive) { velocityX += 1f; } - if (!rightLegActive) + if (!rightLegActive) { velocityX += 1f; } - if (!leftLegActive) + if (!leftLegActive) { velocityX += 1f; } - if (npc.velocity.X < -velocityX) + if (npc.velocity.X < -velocityX) { npc.velocity.X = -velocityX; } - if (npc.velocity.X > velocityX) + if (npc.velocity.X > velocityX) { npc.velocity.X = velocityX; } @@ -461,54 +463,54 @@ namespace CalamityMod.NPCs.Scavenger npc.TargetClosest(true); } int distanceFromTarget = 3000; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)distanceFromTarget) + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)distanceFromTarget) { npc.TargetClosest(true); - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)distanceFromTarget) + if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)distanceFromTarget) { npc.active = false; - npc.netUpdate = true; + npc.netUpdate = true; return; } } } - public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) + public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)mod.GetTexture("NPCs/Scavenger/ScavengerBodyGlow").Width, (float)(mod.GetTexture("NPCs/Scavenger/ScavengerBodyGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; - vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); - Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Blue); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerBodyGlow"), vector, - new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + { + spriteEffects = SpriteEffects.FlipHorizontally; + } + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Vector2 vector = center - Main.screenPosition; + vector -= new Vector2((float)mod.GetTexture("NPCs/Scavenger/ScavengerBodyGlow").Width, (float)(mod.GetTexture("NPCs/Scavenger/ScavengerBodyGlow").Height / Main.npcFrameCount[npc.type])) * 1f / 2f; + vector += vector11 * 1f + new Vector2(0f, 0f + 4f + npc.gfxOffY); + Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(127 - npc.alpha, 127 - npc.alpha, 127 - npc.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Blue); + Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerBodyGlow"), vector, + new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, vector11, 1f, spriteEffects, 0f); Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerLegRight"), new Vector2(center.X - Main.screenPosition.X + 28f, center.Y - Main.screenPosition.Y + 20f), //72 - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerLegRight").Width, mod.GetTexture("NPCs/Scavenger/ScavengerLegRight").Height)), - color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerLegRight").Width, mod.GetTexture("NPCs/Scavenger/ScavengerLegRight").Height)), + color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerLegLeft"), new Vector2(center.X - Main.screenPosition.X - 112f, center.Y - Main.screenPosition.Y + 20f), //72 - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerLegLeft").Width, mod.GetTexture("NPCs/Scavenger/ScavengerLegLeft").Height)), - color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); - if (NPC.CountNPCS(mod.NPCType("ScavengerHead")) > 0) - { - Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerHead"), new Vector2(center.X - Main.screenPosition.X - 70f, center.Y - Main.screenPosition.Y - 75f), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerHead").Width, mod.GetTexture("NPCs/Scavenger/ScavengerHead").Height)), - color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); - } + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerLegLeft").Width, mod.GetTexture("NPCs/Scavenger/ScavengerLegLeft").Height)), + color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + if (NPC.CountNPCS(mod.NPCType("ScavengerHead")) > 0) + { + Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerHead"), new Vector2(center.X - Main.screenPosition.X - 70f, center.Y - Main.screenPosition.Y - 75f), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerHead").Width, mod.GetTexture("NPCs/Scavenger/ScavengerHead").Height)), + color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + } } - + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - + npc.damage = (int)(npc.damage * 0.8f); + } + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) @@ -530,7 +532,7 @@ namespace CalamityMod.NPCs.Scavenger } } } - + public override void BossLoot(ref string name, ref int potionType) { name = "Ravager"; @@ -550,66 +552,80 @@ namespace CalamityMod.NPCs.Scavenger player.AddBuff(mod.BuffType("Horror"), 600, true); } } - + public override void NPCLoot() { - if (CalamityWorld.armageddon) - { - for (int i = 0; i < 5; i++) - { - npc.DropBossBags(); - } - } - if (Main.rand.Next(10) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RavagerTrophy")); - } - if (Main.expertMode) - { - npc.DropBossBags(); - } - else - { - if (CalamityWorld.downedProvidence) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone"), Main.rand.Next(50, 61)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VerstaltiteBar"), Main.rand.Next(5, 11)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DraedonBar"), Main.rand.Next(5, 11)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CruptixBar"), Main.rand.Next(5, 11)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofCinder"), Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofEleum"), Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofChaos"), Main.rand.Next(1, 4)); - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BarofLife")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofCalamity")); - } - } - else - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VerstaltiteBar"), Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DraedonBar"), Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CruptixBar"), Main.rand.Next(1, 4)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofCinder"), Main.rand.Next(1, 3)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofEleum"), Main.rand.Next(1, 3)); - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofChaos"), Main.rand.Next(1, 3)); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodPact")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FleshTotem")); - } - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Hematemesis")); - } - } - } + if (CalamityWorld.armageddon) + { + for (int i = 0; i < 5; i++) + { + npc.DropBossBags(); + } + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RavagerTrophy")); + } + if (Main.expertMode) + { + npc.DropBossBags(); + } + else + { + if (CalamityWorld.downedProvidence) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Bloodstone"), Main.rand.Next(50, 61)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VerstaltiteBar"), Main.rand.Next(5, 11)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DraedonBar"), Main.rand.Next(5, 11)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CruptixBar"), Main.rand.Next(5, 11)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofCinder"), Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofEleum"), Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofChaos"), Main.rand.Next(1, 4)); + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BarofLife")); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofCalamity")); + } + } + else + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VerstaltiteBar"), Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("DraedonBar"), Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CruptixBar"), Main.rand.Next(1, 4)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofCinder"), Main.rand.Next(1, 3)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofEleum"), Main.rand.Next(1, 3)); + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CoreofChaos"), Main.rand.Next(1, 3)); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodPact")); + } + if (Main.rand.Next(3) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("FleshTotem")); + } + switch (Main.rand.Next(5)) + { + case 0: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Hematemesis")); + break; + case 1: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("RealmRavager")); + break; + case 2: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("SpikecragStaff")); + break; + case 3: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("UltimusCleaver")); + break; + case 4: + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CraniumSmasher")); + break; + } + } + } } } \ No newline at end of file diff --git a/NPCs/Scavenger/ScavengerClawLeft.cs b/NPCs/Scavenger/ScavengerClawLeft.cs index ced2f8c687..8181680dde 100644 --- a/NPCs/Scavenger/ScavengerClawLeft.cs +++ b/NPCs/Scavenger/ScavengerClawLeft.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.Scavenger { DisplayName.SetDefault("Ravager"); } - + public override void SetDefaults() { npc.aiStyle = -1; @@ -29,20 +29,20 @@ namespace CalamityMod.NPCs.Scavenger aiType = -1; for (int k = 0; k < npc.buffImmune.Length; k++) { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - } + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.noGravity = true; npc.canGhostHeal = false; npc.alpha = 255; @@ -55,46 +55,48 @@ namespace CalamityMod.NPCs.Scavenger npc.defense = 120; npc.lifeMax = 100000; } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 300000 : 260000; - } - } - + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 300000 : 260000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } + public override void AI() { - if (!Main.npc[CalamityGlobalNPC.scavenger].active) + if (!Main.npc[CalamityGlobalNPC.scavenger].active) { - npc.active = false; - npc.netUpdate = true; + npc.active = false; + npc.netUpdate = true; return; } if (npc.timeLeft < 3000) { npc.timeLeft = 3000; } - if (npc.alpha > 0) + if (npc.alpha > 0) { npc.alpha -= 10; - if (npc.alpha < 0) + if (npc.alpha < 0) { npc.alpha = 0; } npc.ai[1] = 0f; } - if (npc.ai[0] == 0f) + if (npc.ai[0] == 0f) { npc.noTileCollide = true; float num659 = 14f; - if (npc.life < npc.lifeMax / 2) + if (npc.life < npc.lifeMax / 2) { num659 += 1f; } - if (npc.life < npc.lifeMax / 3) + if (npc.life < npc.lifeMax / 3) { num659 += 1f; } - if (npc.life < npc.lifeMax / 5) + if (npc.life < npc.lifeMax / 5) { num659 += 1f; } @@ -104,28 +106,28 @@ namespace CalamityMod.NPCs.Scavenger num661 += 50f; num660 -= 120f; float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 12f + num659) + if (num662 < 12f + num659) { npc.rotation = 0f; npc.velocity.X = num660; npc.velocity.Y = num661; npc.ai[1] += 1f; - if (npc.life < npc.lifeMax / 2) + if (npc.life < npc.lifeMax / 2) { npc.ai[1] += 1f; } - if (npc.life < npc.lifeMax / 3) + if (npc.life < npc.lifeMax / 3) { npc.ai[1] += 1f; } - if (npc.life < npc.lifeMax / 5) + if (npc.life < npc.lifeMax / 5) { npc.ai[1] += 10f; } - if (npc.ai[1] >= 60f) + if (npc.ai[1] >= 60f) { npc.TargetClosest(true); - if ((npc.Center.X + 100f > Main.player[npc.target].Center.X)) + if ((npc.Center.X + 100f > Main.player[npc.target].Center.X)) { npc.ai[1] = 0f; npc.ai[0] = 1f; @@ -134,7 +136,7 @@ namespace CalamityMod.NPCs.Scavenger npc.ai[1] = 0f; return; } - } + } else { num662 = num659 / num662; @@ -142,22 +144,22 @@ namespace CalamityMod.NPCs.Scavenger npc.velocity.Y = num661 * num662; npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); } - } + } else if (npc.ai[0] == 1f) { npc.noTileCollide = true; npc.collideX = false; npc.collideY = false; float num663 = 12f; - if (npc.life < npc.lifeMax / 2) + if (npc.life < npc.lifeMax / 2) { num663 += 4f; } - if (npc.life < npc.lifeMax / 3) + if (npc.life < npc.lifeMax / 3) { num663 += 4f; } - if (npc.life < npc.lifeMax / 5) + if (npc.life < npc.lifeMax / 5) { num663 += 10f; } @@ -170,27 +172,27 @@ namespace CalamityMod.NPCs.Scavenger npc.velocity.Y = num665 * num666; npc.ai[0] = 2f; npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)); - } + } else if (npc.ai[0] == 2f) { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) { - if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) + if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) { npc.noTileCollide = false; } - if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) + if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) { npc.noTileCollide = false; } - } + } else { - if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) + if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) { npc.noTileCollide = false; } - if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) + if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) { npc.noTileCollide = false; } @@ -209,7 +211,7 @@ namespace CalamityMod.NPCs.Scavenger npc.ai[0] = 0f; return; } - } + } else if (npc.ai[0] == 3f) { npc.noTileCollide = true; @@ -222,34 +224,34 @@ namespace CalamityMod.NPCs.Scavenger num675 = num671 / num675; num673 *= num675; num674 *= num675; - if (npc.velocity.X < num673) + if (npc.velocity.X < num673) { npc.velocity.X = npc.velocity.X + num672; - if (npc.velocity.X < 0f && num673 > 0f) + if (npc.velocity.X < 0f && num673 > 0f) { npc.velocity.X = npc.velocity.X + num672 * 2f; } - } + } else if (npc.velocity.X > num673) { npc.velocity.X = npc.velocity.X - num672; - if (npc.velocity.X > 0f && num673 < 0f) + if (npc.velocity.X > 0f && num673 < 0f) { npc.velocity.X = npc.velocity.X - num672 * 2f; } } - if (npc.velocity.Y < num674) + if (npc.velocity.Y < num674) { npc.velocity.Y = npc.velocity.Y + num672; - if (npc.velocity.Y < 0f && num674 > 0f) + if (npc.velocity.Y < 0f && num674 > 0f) { npc.velocity.Y = npc.velocity.Y + num672 * 2f; } - } + } else if (npc.velocity.Y > num674) { npc.velocity.Y = npc.velocity.Y - num672; - if (npc.velocity.Y > 0f && num674 < 0f) + if (npc.velocity.Y > 0f && num674 < 0f) { npc.velocity.Y = npc.velocity.Y - num672 * 2f; } @@ -257,7 +259,7 @@ namespace CalamityMod.NPCs.Scavenger npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)); } } - + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); @@ -286,19 +288,19 @@ namespace CalamityMod.NPCs.Scavenger drawPositionY += 30f; drawPositionX -= 70f; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height)), color, rotation, + Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height)), color, rotation, new Vector2((float)mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width * 0.5f, (float)mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); } } return true; } - + public override bool PreNPCLoot() { return false; } - + public override void OnHitPlayer(Player player, int damage, bool crit) { if (CalamityWorld.revenge) @@ -306,24 +308,24 @@ namespace CalamityMod.NPCs.Scavenger player.AddBuff(mod.BuffType("Horror"), 300, true); } } - + public override void HitEffect(int hitDirection, double damage) { - if (npc.life > 0) - { - int num285 = 0; - while ((double)num285 < damage / (double)npc.lifeMax * 100.0) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f); - num285++; - } - } + if (npc.life > 0) + { + int num285 = 0; + while ((double)num285 < damage / (double)npc.lifeMax * 100.0) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f); + num285++; + } + } else { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft2"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawLeft3"), 1f); } - } + } } } \ No newline at end of file diff --git a/NPCs/Scavenger/ScavengerClawRight.cs b/NPCs/Scavenger/ScavengerClawRight.cs index d0dc1798bc..4447cfbb42 100644 --- a/NPCs/Scavenger/ScavengerClawRight.cs +++ b/NPCs/Scavenger/ScavengerClawRight.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.Scavenger { DisplayName.SetDefault("Ravager"); } - + public override void SetDefaults() { npc.aiStyle = -1; @@ -29,20 +29,20 @@ namespace CalamityMod.NPCs.Scavenger aiType = -1; for (int k = 0; k < npc.buffImmune.Length; k++) { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - } + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.noGravity = true; npc.canGhostHeal = false; npc.alpha = 255; @@ -55,46 +55,48 @@ namespace CalamityMod.NPCs.Scavenger npc.defense = 120; npc.lifeMax = 100000; } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 300000 : 260000; - } - } - + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 300000 : 260000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } + public override void AI() { - if (!Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) + if (!Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) { npc.timeLeft = 3000; } - if (npc.alpha > 0) + if (npc.alpha > 0) { npc.alpha -= 10; - if (npc.alpha < 0) + if (npc.alpha < 0) { npc.alpha = 0; } npc.ai[1] = 0f; } - if (npc.ai[0] == 0f) + if (npc.ai[0] == 0f) { npc.noTileCollide = true; float num659 = 14f; - if (npc.life < npc.lifeMax / 2) + if (npc.life < npc.lifeMax / 2) { num659 += 1f; } - if (npc.life < npc.lifeMax / 3) + if (npc.life < npc.lifeMax / 3) { num659 += 1f; } - if (npc.life < npc.lifeMax / 5) + if (npc.life < npc.lifeMax / 5) { num659 += 1f; } @@ -104,28 +106,28 @@ namespace CalamityMod.NPCs.Scavenger num661 += 50f; num660 += 120f; float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 12f + num659) + if (num662 < 12f + num659) { npc.rotation = 0f; npc.velocity.X = num660; npc.velocity.Y = num661; npc.ai[1] += 1f; - if (npc.life < npc.lifeMax / 2) + if (npc.life < npc.lifeMax / 2) { npc.ai[1] += 1f; } - if (npc.life < npc.lifeMax / 3) + if (npc.life < npc.lifeMax / 3) { npc.ai[1] += 1f; } - if (npc.life < npc.lifeMax / 5) + if (npc.life < npc.lifeMax / 5) { npc.ai[1] += 10f; } - if (npc.ai[1] >= 60f) + if (npc.ai[1] >= 60f) { npc.TargetClosest(true); - if ((npc.Center.X - 100f < Main.player[npc.target].Center.X)) + if ((npc.Center.X - 100f < Main.player[npc.target].Center.X)) { npc.ai[1] = 0f; npc.ai[0] = 1f; @@ -134,7 +136,7 @@ namespace CalamityMod.NPCs.Scavenger npc.ai[1] = 0f; return; } - } + } else { num662 = num659 / num662; @@ -142,22 +144,22 @@ namespace CalamityMod.NPCs.Scavenger npc.velocity.Y = num661 * num662; npc.rotation = (float)Math.Atan2((double)(-(double)npc.velocity.Y), (double)(-(double)npc.velocity.X)); } - } + } else if (npc.ai[0] == 1f) { npc.noTileCollide = true; npc.collideX = false; npc.collideY = false; float num663 = 12f; - if (npc.life < npc.lifeMax / 2) + if (npc.life < npc.lifeMax / 2) { num663 += 4f; } - if (npc.life < npc.lifeMax / 3) + if (npc.life < npc.lifeMax / 3) { num663 += 4f; } - if (npc.life < npc.lifeMax / 5) + if (npc.life < npc.lifeMax / 5) { num663 += 10f; } @@ -170,27 +172,27 @@ namespace CalamityMod.NPCs.Scavenger npc.velocity.Y = num665 * num666; npc.ai[0] = 2f; npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); - } + } else if (npc.ai[0] == 2f) { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) + if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) { - if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) + if (npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) { npc.noTileCollide = false; } - if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) + if (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X) { npc.noTileCollide = false; } - } + } else { - if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) + if (npc.velocity.Y > 0f && npc.Center.Y > Main.player[npc.target].Center.Y) { npc.noTileCollide = false; } - if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) + if (npc.velocity.Y < 0f && npc.Center.Y < Main.player[npc.target].Center.Y) { npc.noTileCollide = false; } @@ -203,13 +205,13 @@ namespace CalamityMod.NPCs.Scavenger num668 += 40f; num667 += 110f; float num669 = (float)Math.Sqrt((double)(num667 * num667 + num668 * num668)); - if ((num669 > 700f || npc.collideX || npc.collideY) | npc.justHit) + if ((num669 > 700f || npc.collideX || npc.collideY) | npc.justHit) { npc.noTileCollide = true; npc.ai[0] = 0f; return; } - } + } else if (npc.ai[0] == 3f) { npc.noTileCollide = true; @@ -222,34 +224,34 @@ namespace CalamityMod.NPCs.Scavenger num675 = num671 / num675; num673 *= num675; num674 *= num675; - if (npc.velocity.X < num673) + if (npc.velocity.X < num673) { npc.velocity.X = npc.velocity.X + num672; - if (npc.velocity.X < 0f && num673 > 0f) + if (npc.velocity.X < 0f && num673 > 0f) { npc.velocity.X = npc.velocity.X + num672 * 2f; } - } + } else if (npc.velocity.X > num673) { npc.velocity.X = npc.velocity.X - num672; - if (npc.velocity.X > 0f && num673 < 0f) + if (npc.velocity.X > 0f && num673 < 0f) { npc.velocity.X = npc.velocity.X - num672 * 2f; } } - if (npc.velocity.Y < num674) + if (npc.velocity.Y < num674) { npc.velocity.Y = npc.velocity.Y + num672; - if (npc.velocity.Y < 0f && num674 > 0f) + if (npc.velocity.Y < 0f && num674 > 0f) { npc.velocity.Y = npc.velocity.Y + num672 * 2f; } - } + } else if (npc.velocity.Y > num674) { npc.velocity.Y = npc.velocity.Y - num672; - if (npc.velocity.Y > 0f && num674 < 0f) + if (npc.velocity.Y > 0f && num674 < 0f) { npc.velocity.Y = npc.velocity.Y - num672 * 2f; } @@ -257,7 +259,7 @@ namespace CalamityMod.NPCs.Scavenger npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X); } } - + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); @@ -286,19 +288,19 @@ namespace CalamityMod.NPCs.Scavenger drawPositionY += 30f; drawPositionX += 70f; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f)); - Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), - new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height)), color, rotation, + Main.spriteBatch.Draw(mod.GetTexture("NPCs/Scavenger/ScavengerChain"), new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), + new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width, mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height)), color, rotation, new Vector2((float)mod.GetTexture("NPCs/Scavenger/ScavengerChain").Width * 0.5f, (float)mod.GetTexture("NPCs/Scavenger/ScavengerChain").Height * 0.5f), 1f, SpriteEffects.None, 0f); } } return true; } - + public override bool PreNPCLoot() { return false; } - + public override void OnHitPlayer(Player player, int damage, bool crit) { if (CalamityWorld.revenge) @@ -307,22 +309,22 @@ namespace CalamityMod.NPCs.Scavenger } } - public override void HitEffect(int hitDirection, double damage) - { - if (npc.life > 0) - { - int num285 = 0; - while ((double)num285 < damage / (double)npc.lifeMax * 100.0) - { - Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f); - num285++; - } - } + public override void HitEffect(int hitDirection, double damage) + { + if (npc.life > 0) + { + int num285 = 0; + while ((double)num285 < damage / (double)npc.lifeMax * 100.0) + { + Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, 0, default(Color), 1f); + num285++; + } + } else { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawRight"), 1f); Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/ScavengerGores/ScavengerClawRight2"), 1f); } } - } + } } \ No newline at end of file diff --git a/NPCs/Scavenger/ScavengerHead.cs b/NPCs/Scavenger/ScavengerHead.cs index 496aa596a8..caa323e3a2 100644 --- a/NPCs/Scavenger/ScavengerHead.cs +++ b/NPCs/Scavenger/ScavengerHead.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.Scavenger { DisplayName.SetDefault("Ravager"); } - + public override void SetDefaults() { npc.aiStyle = -1; @@ -29,20 +29,20 @@ namespace CalamityMod.NPCs.Scavenger aiType = -1; for (int k = 0; k < npc.buffImmune.Length; k++) { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - npc.buffImmune[mod.BuffType("SilvaStun")] = false; - } + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; + npc.buffImmune[mod.BuffType("SilvaStun")] = false; npc.noGravity = true; npc.canGhostHeal = false; npc.alpha = 255; @@ -54,87 +54,89 @@ namespace CalamityMod.NPCs.Scavenger npc.defense = 150; npc.lifeMax = 260000; } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 500000 : 450000; - } - } + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 500000 : 450000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } + + public override void AI() + { + bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); + bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); + Player player = Main.player[npc.target]; + npc.noTileCollide = true; + if (!Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) + { + npc.timeLeft = 3000; + } + float speed = 12f; + Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); + float centerX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; + float centerY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; + centerY -= 20f; + centerX += 1f; + float totalSpeed = (float)Math.Sqrt((double)(centerX * centerX + centerY * centerY)); + if (totalSpeed < 20f) + { + npc.rotation = 0f; + npc.velocity.X = centerX; + npc.velocity.Y = centerY; + } + else + { + totalSpeed = speed / totalSpeed; + npc.velocity.X = centerX * totalSpeed; + npc.velocity.Y = centerY * totalSpeed; + npc.rotation = npc.velocity.X * 0.1f; + } + if (npc.alpha > 0) + { + npc.alpha -= 10; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + npc.ai[1] = 30f; + } + npc.ai[1] += 1f; + int nukeTimer = 450; + if (npc.ai[1] >= (float)nukeTimer) + { + Main.PlaySound(SoundID.Item62, npc.position); + npc.TargetClosest(true); + npc.ai[1] = 0f; + Vector2 shootFromVector = new Vector2(npc.Center.X, npc.Center.Y - 20f); + float nukeSpeed = 1f; + float playerDistanceX = player.position.X + (float)player.width * 0.5f - shootFromVector.X; + float playerDistanceY = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y; + float totalPlayerDistance = (float)Math.Sqrt((double)(playerDistanceX * playerDistanceX + playerDistanceY * playerDistanceY)); + totalPlayerDistance = nukeSpeed / totalPlayerDistance; + playerDistanceX *= totalPlayerDistance; + playerDistanceY *= totalPlayerDistance; + int nukeDamage = expertMode ? 40 : 60; + int projectileType = mod.ProjectileType("ScavengerNuke"); + if (Main.netMode != 1) + { + int nuke = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, playerDistanceX, playerDistanceY, projectileType, nukeDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Main.projectile[nuke].velocity.Y = -15f; + } + } + } - public override void AI() - { - bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); - bool expertMode = (Main.expertMode || CalamityWorld.bossRushActive); - Player player = Main.player[npc.target]; - npc.noTileCollide = true; - if (!Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) - { - npc.timeLeft = 3000; - } - float speed = 12f; - Vector2 center = new Vector2(npc.Center.X, npc.Center.Y); - float centerX = Main.npc[CalamityGlobalNPC.scavenger].Center.X - center.X; - float centerY = Main.npc[CalamityGlobalNPC.scavenger].Center.Y - center.Y; - centerY -= 20f; - centerX += 1f; - float totalSpeed = (float)Math.Sqrt((double)(centerX * centerX + centerY * centerY)); - if (totalSpeed < 20f) - { - npc.rotation = 0f; - npc.velocity.X = centerX; - npc.velocity.Y = centerY; - } - else - { - totalSpeed = speed / totalSpeed; - npc.velocity.X = centerX * totalSpeed; - npc.velocity.Y = centerY * totalSpeed; - npc.rotation = npc.velocity.X * 0.1f; - } - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - npc.ai[1] = 30f; - } - npc.ai[1] += 1f; - int nukeTimer = 450; - if (npc.ai[1] >= (float)nukeTimer) - { - Main.PlaySound(SoundID.Item62, npc.position); - npc.TargetClosest(true); - npc.ai[1] = 0f; - Vector2 shootFromVector = new Vector2(npc.Center.X, npc.Center.Y - 20f); - float nukeSpeed = 1f; - float playerDistanceX = player.position.X + (float)player.width * 0.5f - shootFromVector.X; - float playerDistanceY = player.position.Y + (float)player.height * 0.5f - shootFromVector.Y; - float totalPlayerDistance = (float)Math.Sqrt((double)(playerDistanceX * playerDistanceX + playerDistanceY * playerDistanceY)); - totalPlayerDistance = nukeSpeed / totalPlayerDistance; - playerDistanceX *= totalPlayerDistance; - playerDistanceY *= totalPlayerDistance; - int nukeDamage = expertMode ? 40 : 60; - int projectileType = mod.ProjectileType("ScavengerNuke"); - if (Main.netMode != 1) - { - int nuke = Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, playerDistanceX, playerDistanceY, projectileType, nukeDamage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); - Main.projectile[nuke].velocity.Y = -15f; - } - } - } - public override bool PreNPCLoot() { return false; } - + public override void HitEffect(int hitDirection, double damage) { if (npc.life > 0) diff --git a/NPCs/Scavenger/ScavengerLegLeft.cs b/NPCs/Scavenger/ScavengerLegLeft.cs index 9d022082d2..d90e5de3ff 100644 --- a/NPCs/Scavenger/ScavengerLegLeft.cs +++ b/NPCs/Scavenger/ScavengerLegLeft.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.Scavenger { DisplayName.SetDefault("Ravager"); } - + public override void SetDefaults() { npc.aiStyle = -1; @@ -29,19 +29,19 @@ namespace CalamityMod.NPCs.Scavenger aiType = -1; for (int k = 0; k < npc.buffImmune.Length; k++) { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - } + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; npc.noGravity = true; npc.canGhostHeal = false; npc.alpha = 255; @@ -53,30 +53,32 @@ namespace CalamityMod.NPCs.Scavenger npc.defense = 135; npc.lifeMax = 200000; } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 450000 : 400000; - } - } - + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 450000 : 400000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } + public override void AI() { bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); Vector2 center = npc.Center; - if (!Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) + if (!Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) { npc.timeLeft = 3000; } - if (npc.alpha > 0) + if (npc.alpha > 0) { npc.alpha -= 10; - if (npc.alpha < 0) + if (npc.alpha < 0) { npc.alpha = 0; } @@ -92,19 +94,19 @@ namespace CalamityMod.NPCs.Scavenger Main.projectile[smash].friendly = false; } } - if (npc.ai[0] == 0f) + if (npc.ai[0] == 0f) { npc.noTileCollide = true; float num659 = 14f; - if (npc.life < npc.lifeMax / 2) + if (npc.life < npc.lifeMax / 2) { num659 += 3f; } - if (npc.life < npc.lifeMax / 3) + if (npc.life < npc.lifeMax / 3) { num659 += 3f; } - if (npc.life < npc.lifeMax / 5) + if (npc.life < npc.lifeMax / 5) { num659 += 8f; } @@ -114,7 +116,7 @@ namespace CalamityMod.NPCs.Scavenger num661 += 88f; num660 -= 70f; float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 12f + num659) + if (num662 < 12f + num659) { npc.rotation = 0f; npc.velocity.X = num660; @@ -128,12 +130,12 @@ namespace CalamityMod.NPCs.Scavenger } } } - + public override bool PreNPCLoot() { return false; } - + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) diff --git a/NPCs/Scavenger/ScavengerLegRight.cs b/NPCs/Scavenger/ScavengerLegRight.cs index ca5017b338..f80a856315 100644 --- a/NPCs/Scavenger/ScavengerLegRight.cs +++ b/NPCs/Scavenger/ScavengerLegRight.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.Scavenger { DisplayName.SetDefault("Ravager"); } - + public override void SetDefaults() { npc.aiStyle = -1; @@ -29,19 +29,19 @@ namespace CalamityMod.NPCs.Scavenger aiType = -1; for (int k = 0; k < npc.buffImmune.Length; k++) { - npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[BuffID.Daybreak] = false; - npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; - npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; - npc.buffImmune[mod.BuffType("HolyLight")] = false; - npc.buffImmune[mod.BuffType("Nightwither")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; - npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; - } + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[BuffID.Daybreak] = false; + npc.buffImmune[mod.BuffType("AbyssalFlames")] = false; + npc.buffImmune[mod.BuffType("ArmorCrunch")] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("GodSlayerInferno")] = false; + npc.buffImmune[mod.BuffType("HolyLight")] = false; + npc.buffImmune[mod.BuffType("Nightwither")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; + npc.buffImmune[mod.BuffType("WhisperingDeath")] = false; npc.noGravity = true; npc.canGhostHeal = false; npc.alpha = 255; @@ -53,30 +53,32 @@ namespace CalamityMod.NPCs.Scavenger npc.defense = 135; npc.lifeMax = 200000; } - if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 450000 : 400000; - } - } - + if (CalamityWorld.bossRushActive) + { + npc.lifeMax = CalamityWorld.death ? 450000 : 400000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + } + public override void AI() { bool provy = (CalamityWorld.downedProvidence && !CalamityWorld.bossRushActive); Vector2 center = npc.Center; - if (!Main.npc[CalamityGlobalNPC.scavenger].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - if (npc.timeLeft < 3000) + if (!Main.npc[CalamityGlobalNPC.scavenger].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + if (npc.timeLeft < 3000) { npc.timeLeft = 3000; } - if (npc.alpha > 0) + if (npc.alpha > 0) { npc.alpha -= 10; - if (npc.alpha < 0) + if (npc.alpha < 0) { npc.alpha = 0; } @@ -92,19 +94,19 @@ namespace CalamityMod.NPCs.Scavenger Main.projectile[smash].friendly = false; } } - if (npc.ai[0] == 0f) + if (npc.ai[0] == 0f) { npc.noTileCollide = true; float num659 = 14f; - if (npc.life < npc.lifeMax / 2) + if (npc.life < npc.lifeMax / 2) { num659 += 3f; } - if (npc.life < npc.lifeMax / 3) + if (npc.life < npc.lifeMax / 3) { num659 += 3f; } - if (npc.life < npc.lifeMax / 5) + if (npc.life < npc.lifeMax / 5) { num659 += 8f; } @@ -114,7 +116,7 @@ namespace CalamityMod.NPCs.Scavenger num661 += 88f; num660 += 70f; float num662 = (float)Math.Sqrt((double)(num660 * num660 + num661 * num661)); - if (num662 < 12f + num659) + if (num662 < 12f + num659) { npc.rotation = 0f; npc.velocity.X = num660; @@ -128,12 +130,12 @@ namespace CalamityMod.NPCs.Scavenger } } } - + public override bool PreNPCLoot() { return false; } - + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index 407f7e3a74..98fbfdf15d 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -37,7 +37,9 @@ namespace CalamityMod.NPCs.SlimeGod { npc.lifeMax = CalamityWorld.death ? 2500000 : 2200000; } - npc.aiStyle = -1; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; npc.buffImmune[mod.BuffType("GlacialState")] = true; npc.buffImmune[mod.BuffType("TemporalSadness")] = true; diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 8a0c1909cc..63b2c3879f 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -34,6 +34,8 @@ namespace CalamityMod.NPCs.SlimeGod { npc.lifeMax = CalamityWorld.death ? 2700000 : 2500000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); NPCID.Sets.TrailCacheLength[npc.type] = 8; NPCID.Sets.TrailingMode[npc.type] = 1; npc.aiStyle = -1; //new @@ -116,7 +118,7 @@ namespace CalamityMod.NPCs.SlimeGod npc.damage = 75; if (Main.netMode != 1) { - npc.localAI[1] += (npc.GetGlobalNPC(mod).enraged ? 2f : 1f); + npc.localAI[1] += ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 2f : 1f); if (expertMode && Main.rand.Next(2) == 0) { if (npc.localAI[0] >= 75f) @@ -217,7 +219,7 @@ namespace CalamityMod.NPCs.SlimeGod { num1372 = 22f; } - if (npc.GetGlobalNPC(mod).enraged) + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num1372 += 8f; } diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index e3003b8418..3ba81b7aaa 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -40,7 +40,9 @@ namespace CalamityMod.NPCs.SlimeGod { npc.lifeMax = CalamityWorld.death ? 2000000 : 1600000; } - npc.knockBackResist = 0f; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.knockBackResist = 0f; animationType = 50; npc.buffImmune[mod.BuffType("GlacialState")] = true; npc.buffImmune[mod.BuffType("TemporalSadness")] = true; diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index 52adf618b7..1bf21e93b4 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -35,7 +35,9 @@ namespace CalamityMod.NPCs.SlimeGod { npc.lifeMax = CalamityWorld.death ? 1000000 : 800000; } - npc.damage = 40; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.damage = 40; npc.width = 150; npc.height = 92; npc.scale = 0.8f; diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index 2d8a0d9619..dd6d66fde5 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -32,7 +32,9 @@ namespace CalamityMod.NPCs.SlimeGod { npc.lifeMax = CalamityWorld.death ? 1250000 : 1100000; } - npc.damage = 40; + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.damage = 40; npc.width = 150; npc.height = 92; npc.scale = 0.8f; diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 9a54bbed8c..0c2c1ac1f4 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -44,7 +44,9 @@ namespace CalamityMod.NPCs.StormWeaver { npc.lifeMax = 170000; } - npc.aiStyle = 6; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index 889ca8b6b8..cc14db2c31 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -45,7 +45,9 @@ namespace CalamityMod.NPCs.StormWeaver { npc.lifeMax = 2300000; } - npc.aiStyle = 6; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; @@ -63,7 +65,6 @@ namespace CalamityMod.NPCs.StormWeaver for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; } npc.dontCountMe = true; } diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index bd671a66d3..537f73a671 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -54,7 +54,9 @@ namespace CalamityMod.NPCs.StormWeaver { npc.lifeMax = 170000; } - npc.aiStyle = 6; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; @@ -266,6 +268,11 @@ namespace CalamityMod.NPCs.StormWeaver { num188 = revenge ? 14f : 13f; num189 = revenge ? 0.44f : 0.4f; + if (!Main.player[npc.target].ZoneSkyHeight) + { + num188 = 20f; + num189 = 0.5f; + } } float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index d0366a84d1..9da5e9d9d8 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -56,7 +56,9 @@ namespace CalamityMod.NPCs.StormWeaver { npc.lifeMax = 2300000; } - npc.aiStyle = 6; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; @@ -73,7 +75,6 @@ namespace CalamityMod.NPCs.StormWeaver for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; } } @@ -272,6 +273,11 @@ namespace CalamityMod.NPCs.StormWeaver { num188 = revenge ? 17f : 16f; num189 = revenge ? 0.5f : 0.45f; + if (!Main.player[npc.target].ZoneSkyHeight) + { + num188 = 24f; + num189 = 0.6f; + } } float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 341d8660aa..0a06b02036 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -42,7 +42,9 @@ namespace CalamityMod.NPCs.StormWeaver { npc.lifeMax = 170000; } - npc.aiStyle = 6; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index e53b0df4d8..d059c1461e 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -44,7 +44,9 @@ namespace CalamityMod.NPCs.StormWeaver { npc.lifeMax = 2300000; } - npc.aiStyle = 6; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new aiType = -1; //new animationType = 10; //new npc.knockBackResist = 0f; @@ -62,7 +64,6 @@ namespace CalamityMod.NPCs.StormWeaver for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; } npc.dontCountMe = true; } diff --git a/NPCs/SunkenSeaNPCs/Clam.cs b/NPCs/SunkenSeaNPCs/Clam.cs index 385f1db467..31176d4ee6 100644 --- a/NPCs/SunkenSeaNPCs/Clam.cs +++ b/NPCs/SunkenSeaNPCs/Clam.cs @@ -205,6 +205,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs } public override void NPCLoot() { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Navystone"), Main.rand.Next(8, 13)); if (Main.rand.Next(2) == 0 && Main.hardMode) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("MolluskHusk")); diff --git a/NPCs/SunkenSeaNPCs/GiantClam.cs b/NPCs/SunkenSeaNPCs/GiantClam.cs index 1bc4c0599d..96a02a7e3d 100644 --- a/NPCs/SunkenSeaNPCs/GiantClam.cs +++ b/NPCs/SunkenSeaNPCs/GiantClam.cs @@ -13,12 +13,12 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs { public class GiantClam : ModNPC { - public int hitAmount = 0; - public int attack = -1; //-1 doing nothing, 0 = shell hiding, 1 = telestomp, 2 = pearl burst, 3 = pearl rain - public bool attackAnim = false; - public bool hasBeenHit = false; - public bool statChange = false; - public bool hide = false; + private int hitAmount = 0; + private int attack = -1; //-1 doing nothing, 0 = shell hiding, 1 = telestomp, 2 = pearl burst, 3 = pearl rain + private bool attackAnim = false; + private bool hasBeenHit = false; + private bool statChange = false; + private bool hide = false; public override void SetStaticDefaults() { @@ -36,6 +36,12 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs //npc.defense = Main.hardMode ? 35 : 10; npc.defense = 9999; npc.lifeMax = Main.hardMode ? 7500 : 1250; + for (int k = 0; k < npc.buffImmune.Length; k++) + { + npc.buffImmune[k] = true; + } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; npc.aiStyle = -1; aiType = -1; npc.value = Main.hardMode ? Item.buyPrice(0, 10, 0, 0) : Item.buyPrice(0, 1, 0, 0); @@ -269,6 +275,11 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs } } + public override bool CheckActive() + { + return Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 5600f; + } + public override bool? CanBeHitByProjectile(Projectile projectile) { if (projectile.minion) @@ -360,6 +371,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs { NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("SEAHOE"), 0, 0f, 0f, 0f, 0f, 255); } + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("Navystone"), Main.rand.Next(25, 36)); if (Main.rand.Next(3) == 0) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GiantPearl")); diff --git a/NPCs/SunkenSeaNPCs/GiantClamGlow.png b/NPCs/SunkenSeaNPCs/GiantClamGlow.png index f10c17be37..102d70e594 100644 Binary files a/NPCs/SunkenSeaNPCs/GiantClamGlow.png and b/NPCs/SunkenSeaNPCs/GiantClamGlow.png differ diff --git a/NPCs/SupremeCalamitas/SCalWormBody.cs b/NPCs/SupremeCalamitas/SCalWormBody.cs index 9a6337bd07..f6e42aaff9 100644 --- a/NPCs/SupremeCalamitas/SCalWormBody.cs +++ b/NPCs/SupremeCalamitas/SCalWormBody.cs @@ -77,7 +77,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) + { + projectile.penetrate = 1; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { Mod mod = ModLoader.GetMod("CalamityMod"); Texture2D texture = mod.GetTexture("NPCs/SupremeCalamitas/SCalWormBodyAlt"); diff --git a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs index 91a32034d8..3a9f51029e 100644 --- a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs +++ b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs @@ -89,7 +89,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - public override bool CheckActive() + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) + { + projectile.penetrate = 1; + } + } + + public override bool CheckActive() { return false; } diff --git a/NPCs/SupremeCalamitas/SCalWormHead.cs b/NPCs/SupremeCalamitas/SCalWormHead.cs index 5758cfa222..c0a0560615 100644 --- a/NPCs/SupremeCalamitas/SCalWormHead.cs +++ b/NPCs/SupremeCalamitas/SCalWormHead.cs @@ -415,7 +415,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; } - public override bool CheckActive() + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) + { + projectile.penetrate = 1; + } + } + + public override bool CheckActive() { return false; } diff --git a/NPCs/SupremeCalamitas/SCalWormTail.cs b/NPCs/SupremeCalamitas/SCalWormTail.cs index 6cfc2a5b1f..f49b2af9a9 100644 --- a/NPCs/SupremeCalamitas/SCalWormTail.cs +++ b/NPCs/SupremeCalamitas/SCalWormTail.cs @@ -77,7 +77,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - public override void HitEffect(int hitDirection, double damage) + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if ((projectile.penetrate == -1 || projectile.penetrate > 1) && !projectile.minion) + { + projectile.penetrate = 1; + } + } + + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index d4f24ed395..87278e5705 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -36,8 +36,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 0edffbdc22..f9cb57f9fc 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -76,6 +76,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.lifeMax = CalamityWorld.death ? 2300000 : 2100000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.aiStyle = -1; //new aiType = -1; //new npc.knockBackResist = 0f; @@ -84,9 +86,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; npc.dontTakeDamage = false; npc.chaseable = true; npc.boss = true; @@ -321,7 +323,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != 1) { npc.localAI[0] += 1f; - if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 4f : 6f)) + if (npc.localAI[0] > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 4f : 6f)) { npc.localAI[0] = 0f; int damage = expertMode ? 200 : 250; //800 500 @@ -431,7 +433,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } npc.localAI[0] += 1f; - if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 6f : 9f)) + if (npc.localAI[0] > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 6f : 9f)) { npc.localAI[0] = 0f; if (npc.localAI[2] < 1200f) //blasts from below @@ -491,10 +493,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (npc.localAI[2] % 240 == 0) //fireblasts from above { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 1f, 0f); } npc.localAI[0] += 1f; - if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 9f : 11f)) + if (npc.localAI[0] > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 9f : 11f)) { npc.localAI[0] = 0f; if (npc.localAI[2] < 2100f) //blasts from above @@ -559,7 +561,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (npc.localAI[2] % 240 == 0) //fireblasts from above { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 1f, 0f); } if (npc.localAI[2] % 450 == 0) //giant homing fireballs { @@ -567,7 +569,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas passedVar += 1f; } npc.localAI[0] += 1f; - if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 12f : 15f)) + if (npc.localAI[0] > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 12f : 15f)) { npc.localAI[0] = 0f; if (npc.localAI[2] < 3000f) //blasts from below @@ -632,7 +634,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (npc.localAI[2] % 360 == 0) //fireblasts from above { - Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + (float)Main.rand.Next(-1000, 1000), player.position.Y - 1000f, 0f, 10f * uDieLul, mod.ProjectileType("BrimstoneFireblast"), damage, 0f, Main.myPlayer, 1f, 0f); } if (npc.localAI[2] % 450 == 0) //giant homing fireballs { @@ -644,7 +646,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Projectile.NewProjectile(player.position.X + 1000f, player.position.Y + (float)Main.rand.Next(-500, 500), -10f * uDieLul, 0f, mod.ProjectileType("BrimstoneWave"), damage, 0f, Main.myPlayer, 0f, 0f); } npc.localAI[0] += 1f; - if (npc.localAI[0] > (npc.GetGlobalNPC(mod).enraged ? 15f : 18f)) + if (npc.localAI[0] > ((npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) ? 15f : 18f)) { npc.localAI[0] = 0f; if (npc.localAI[2] < 3900f) //blasts from above @@ -1038,6 +1040,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas { npc.dontTakeDamage = true; npc.chaseable = false; + npc.damage = 0; + npc.TargetClosest(true); + npc.velocity *= 0.95f; + Vector2 vector92 = new Vector2(npc.Center.X, npc.Center.Y); + float num740 = player.Center.X - vector92.X; + float num741 = player.Center.Y - vector92.Y; + npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + return; } else { diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index 0cc758adc1..175d0f3efa 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -13,7 +13,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas [AutoloadBossHead] public class SupremeCataclysm : ModNPC { - public float distanceX = 250f; + private float distanceY = -375f; public override void SetStaticDefaults() { @@ -28,12 +28,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 120; //324 npc.height = 120; //216 npc.defense = 150; - npc.lifeMax = CalamityWorld.revenge ? 700000 : 600000; + npc.lifeMax = CalamityWorld.revenge ? 1400000 : 1200000; if (CalamityWorld.death) { - npc.lifeMax = 500000; + npc.lifeMax = 1000000; } - npc.aiStyle = -1; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; //new aiType = -1; //new npc.knockBackResist = 0f; NPCID.Sets.TrailCacheLength[npc.type] = 8; @@ -68,27 +70,25 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.TargetClosest(true); float num676 = 60f; float num677 = 1.5f; - float distanceY = 450f; - if (npc.localAI[1] <= 1000f) + float distanceX = 750f; + if (npc.localAI[1] < 750f) { npc.localAI[1] += 1f; - distanceX += 0.5f; + distanceY += 1f; } - else if (npc.localAI[1] <= 2000f) + else if (npc.localAI[1] < 1500f) { npc.localAI[1] += 1f; - distanceX -= 0.5f; + distanceY -= 1f; } - if (npc.localAI[1] >= 2000f) + if (npc.localAI[1] >= 1500f) { npc.localAI[1] = 0f; } Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); float num678 = Main.player[npc.target].Center.X - vector83.X + distanceX; - float num679 = Main.player[npc.target].Center.Y - vector83.Y - distanceY; - float num740 = Main.player[npc.target].Center.X - vector83.X; - float num741 = Main.player[npc.target].Center.Y - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; + float num679 = Main.player[npc.target].Center.Y - vector83.Y + distanceY; + npc.rotation = 1.57f; float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); num680 = num676 / num680; num678 *= num680; @@ -125,29 +125,107 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.velocity.Y = npc.velocity.Y - num677; } } - npc.ai[1] += 1f; - if (npc.ai[1] > 150f) + if (npc.localAI[0] < 120f) { - npc.ai[1] = 0f; - Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); - float num689 = 2f; - int num690 = expertMode ? 150 : 200; //600 500 - int num691 = mod.ProjectileType("BrimstoneHellblast"); - float num692 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector85.X; - float num693 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector85.Y; - float num694 = (float)Math.Sqrt((double)(num692 * num692 + num693 * num693)); - num694 = num689 / num694; - num692 *= num694; - num693 *= num694; - vector85.X += num692 * 3f; - vector85.Y += num693 * 3f; - if (Main.netMode != 1) + npc.localAI[0] += 1f; + } + if (npc.localAI[0] >= 120f) + { + npc.ai[1] += 1f; + if (npc.ai[1] >= 60f) { - int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num692, num693, num691, num690, 0f, Main.myPlayer, 0f, 0f); + npc.ai[1] = 0f; + Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); + float num689 = -8f; + int num690 = expertMode ? 150 : 200; //600 500 + int num691 = mod.ProjectileType("BrimstoneWave"); + if (Main.netMode != 1) + { + int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num689, 0f, num691, num690, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.ai[2] += 1f; + if (!NPC.AnyNPCs(mod.NPCType("SupremeCatastrophe"))) + { + npc.ai[2] += 2f; + } + if (npc.ai[2] >= 300f) + { + npc.ai[2] = 0f; + float num689 = 7f; + int num690 = expertMode ? 150 : 200; //600 500 + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 20); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (Main.netMode != 1) + { + for (i = 0; i < 8; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * num689), (float)(Math.Cos(offsetAngle) * num689), mod.ProjectileType("BrimstoneBarrage"), num690, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(-Math.Sin(offsetAngle) * num689), (float)(-Math.Cos(offsetAngle) * num689), mod.ProjectileType("BrimstoneBarrage"), num690, 0f, Main.myPlayer, 0f, 1f); + } + } + for (int dust = 0; dust <= 5; dust++) + { + Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 235, 0f, 0f); + } } } } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("AngryChicken")) + { + damage /= 2; + } + if (projectile.type == mod.ProjectileType("ApothMark") || projectile.type == mod.ProjectileType("ApothJaws")) + { + damage /= 3; + } + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (damage > npc.lifeMax / 2) + { + damage = 0; + return false; + } + double newDamage = (damage + (int)((double)defense * 0.25)); + float protection = (CalamityWorld.death ? 0.75f : 0.7f); //45% + if (CalamityWorld.bossRushActive) + { + protection = 0.6f; + } + if (newDamage < 1.0) + { + newDamage = 1.0; + } + if (npc.ichor) + { + protection *= 0.9f; //41% + } + else if (npc.onFire2) + { + protection *= 0.91f; + } + if (newDamage >= 1.0) + { + newDamage = (double)((int)((double)(1f - protection) * newDamage)); + if (newDamage < 1.0) + { + newDamage = 1.0; + } + } + damage = newDamage; + return true; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 95ba49331e..2b195a699b 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -13,7 +13,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas [AutoloadBossHead] public class SupremeCatastrophe : ModNPC { - public float distanceX = 250f; + private float distanceY = 375f; public override void SetStaticDefaults() { @@ -28,12 +28,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 120; //324 npc.height = 120; //216 npc.defense = 150; - npc.lifeMax = CalamityWorld.revenge ? 700000 : 600000; + npc.lifeMax = CalamityWorld.revenge ? 1400000 : 1200000; if (CalamityWorld.death) { - npc.lifeMax = 500000; + npc.lifeMax = 1000000; } - npc.aiStyle = -1; //new + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; //new aiType = -1; //new npc.knockBackResist = 0f; npc.noGravity = true; @@ -56,96 +58,172 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.frame.Y = frame * frameHeight; } - public override void AI() + public override void AI() { bool expertMode = Main.expertMode; - if (!Main.npc[CalamityGlobalNPC.SCal].active) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.TargetClosest(true); + if (!Main.npc[CalamityGlobalNPC.SCal].active) + { + npc.active = false; + npc.netUpdate = true; + return; + } + npc.TargetClosest(true); float num676 = 60f; float num677 = 1.5f; - float distanceY = 450f; - if (npc.localAI[1] <= 1000f) + float distanceX = 750f; + if (npc.localAI[1] < 750f) { npc.localAI[1] += 1f; - distanceX += 0.5f; + distanceY -= 1f; } - else if (npc.localAI[1] <= 2000f) + else if (npc.localAI[1] < 1500f) { npc.localAI[1] += 1f; - distanceX -= 0.5f; + distanceY += 1f; } - if (npc.localAI[1] >= 2000f) + if (npc.localAI[1] >= 1500f) { npc.localAI[1] = 0f; } Vector2 vector83 = new Vector2(npc.Center.X, npc.Center.Y); float num678 = Main.player[npc.target].Center.X - vector83.X - distanceX; - float num679 = Main.player[npc.target].Center.Y - vector83.Y - distanceY; - float num740 = Main.player[npc.target].Center.X - vector83.X; - float num741 = Main.player[npc.target].Center.Y - vector83.Y; - npc.rotation = (float)Math.Atan2((double)num741, (double)num740) - 1.57f; - float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); + float num679 = Main.player[npc.target].Center.Y - vector83.Y + distanceY; + npc.rotation = 4.71f; + float num680 = (float)Math.Sqrt((double)(num678 * num678 + num679 * num679)); num680 = num676 / num680; num678 *= num680; num679 *= num680; - if (npc.velocity.X < num678) + if (npc.velocity.X < num678) { npc.velocity.X = npc.velocity.X + num677; - if (npc.velocity.X < 0f && num678 > 0f) + if (npc.velocity.X < 0f && num678 > 0f) { npc.velocity.X = npc.velocity.X + num677; } - } - else if (npc.velocity.X > num678) + } + else if (npc.velocity.X > num678) { npc.velocity.X = npc.velocity.X - num677; - if (npc.velocity.X > 0f && num678 < 0f) + if (npc.velocity.X > 0f && num678 < 0f) { npc.velocity.X = npc.velocity.X - num677; } } - if (npc.velocity.Y < num679) + if (npc.velocity.Y < num679) { npc.velocity.Y = npc.velocity.Y + num677; - if (npc.velocity.Y < 0f && num679 > 0f) + if (npc.velocity.Y < 0f && num679 > 0f) { npc.velocity.Y = npc.velocity.Y + num677; } - } + } else if (npc.velocity.Y > num679) { npc.velocity.Y = npc.velocity.Y - num677; - if (npc.velocity.Y > 0f && num679 < 0f) + if (npc.velocity.Y > 0f && num679 < 0f) { npc.velocity.Y = npc.velocity.Y - num677; } } - npc.ai[1] += 1f; - if (npc.ai[1] >= 150f) - { - npc.ai[1] = 0f; - Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); - float num689 = 2f; - int num690 = expertMode ? 150 : 200; //600 500 - int num691 = mod.ProjectileType("BrimstoneHellblast"); - float num692 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector85.X; - float num693 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector85.Y; - float num694 = (float)Math.Sqrt((double)(num692 * num692 + num693 * num693)); - num694 = num689 / num694; - num692 *= num694; - num693 *= num694; - vector85.X += num692 * 3f; - vector85.Y += num693 * 3f; - if (Main.netMode != 1) - { - int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num692, num693, num691, num690, 0f, Main.myPlayer, 0f, 0f); - } - } + if (npc.localAI[0] < 120f) + { + npc.localAI[0] += 1f; + } + if (npc.localAI[0] >= 120f) + { + npc.ai[1] += 1f; + if (npc.ai[1] >= 30f) + { + npc.ai[1] = 0f; + Vector2 vector85 = new Vector2(npc.Center.X, npc.Center.Y); + float num689 = 4f; + int num690 = expertMode ? 150 : 200; //600 500 + int num691 = mod.ProjectileType("BrimstoneHellblast2"); + if (Main.netMode != 1) + { + int num695 = Projectile.NewProjectile(vector85.X, vector85.Y, num689, 0f, num691, num690, 0f, Main.myPlayer, 0f, 0f); + } + } + npc.ai[2] += 1f; + if (!NPC.AnyNPCs(mod.NPCType("SupremeCataclysm"))) + { + npc.ai[2] += 2f; + } + if (npc.ai[2] >= 300f) + { + npc.ai[2] = 0f; + float num689 = 7f; + int num690 = expertMode ? 150 : 200; //600 500 + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 20); + float spread = 45f * 0.0174f; + double startAngle = Math.Atan2(npc.velocity.X, npc.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (Main.netMode != 1) + { + for (i = 0; i < 8; i++) + { + offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * num689), (float)(Math.Cos(offsetAngle) * num689), mod.ProjectileType("BrimstoneBarrage"), num690, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(-Math.Sin(offsetAngle) * num689), (float)(-Math.Cos(offsetAngle) * num689), mod.ProjectileType("BrimstoneBarrage"), num690, 0f, Main.myPlayer, 0f, 1f); + } + } + for (int dust = 0; dust <= 5; dust++) + { + Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 235, 0f, 0f); + } + } + } + } + + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("AngryChicken")) + { + damage /= 2; + } + if (projectile.type == mod.ProjectileType("ApothMark") || projectile.type == mod.ProjectileType("ApothJaws")) + { + damage /= 3; + } + } + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + if (damage > npc.lifeMax / 2) + { + damage = 0; + return false; + } + double newDamage = (damage + (int)((double)defense * 0.25)); + float protection = (CalamityWorld.death ? 0.75f : 0.7f); //45% + if (CalamityWorld.bossRushActive) + { + protection = 0.6f; + } + if (newDamage < 1.0) + { + newDamage = 1.0; + } + if (npc.ichor) + { + protection *= 0.9f; //41% + } + else if (npc.onFire2) + { + protection *= 0.91f; + } + if (newDamage >= 1.0) + { + newDamage = (double)((int)((double)(1f - protection) * newDamage)); + if (newDamage < 1.0) + { + newDamage = 1.0; + } + } + damage = newDamage; + return true; } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs index f52a5ce5f9..69f3e21938 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs @@ -12,13 +12,13 @@ namespace CalamityMod.NPCs.TheDevourerofGods { public class DevourerofGodsBody : ModNPC { - public int invinceTime = 360; + private int invinceTime = 360; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("The Devourer of Gods"); } - + public override void SetDefaults() { npc.damage = 180; //70 @@ -26,21 +26,23 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.width = 34; //38 npc.height = 34; //30 npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 500000 : 450000; //1000000 960000 - if (CalamityWorld.death) - { - npc.lifeMax = 850000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new + npc.lifeMax = CalamityWorld.revenge ? 500000 : 450000; //1000000 960000 + if (CalamityWorld.death) + { + npc.lifeMax = 850000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new npc.knockBackResist = 0f; npc.scale = 1.4f; npc.alpha = 255; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; - npc.chaseable = false; + npc.chaseable = false; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; @@ -50,42 +52,42 @@ namespace CalamityMod.NPCs.TheDevourerofGods { npc.buffImmune[k] = true; } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; npc.dontCountMe = true; if (Main.expertMode) { npc.scale = 1.5f; } } - + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { return false; } - + public override void AI() { - bool expertMode = Main.expertMode; + bool expertMode = Main.expertMode; 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); - if (invinceTime > 0) - { - invinceTime--; - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } + if (invinceTime > 0) + { + invinceTime--; + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + if (!Main.npc[(int)npc.ai[1]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) @@ -110,83 +112,55 @@ namespace CalamityMod.NPCs.TheDevourerofGods int projectileType = mod.ProjectileType("DoGNebulaShot"); int damage = expertMode ? 55 : 68; float num941 = 5f; - if (npc.localAI[0] >= (float)Main.rand.Next(2800, 32000)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); - float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); - num944 = num941 / num944; - num942 *= num944; - num943 *= num944; - num942 += (float)Main.rand.Next(-5, 6) * 0.05f; - num943 += (float)Main.rand.Next(-5, 6) * 0.05f; - vector104.X += num942 * 5f; - vector104.Y += num943 * 5f; - Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } + if (npc.localAI[0] >= (float)Main.rand.Next(2800, 32000)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float num942 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector104.X + (float)Main.rand.Next(-20, 21); + float num943 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - vector104.Y + (float)Main.rand.Next(-20, 21); + float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + num944 = num941 / num944; + num942 *= num944; + num943 *= num944; + num942 += (float)Main.rand.Next(-5, 6) * 0.05f; + num943 += (float)Main.rand.Next(-5, 6) * 0.05f; + vector104.X += num942 * 5f; + vector104.Y += num943 * 5f; + Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, projectileType, damage, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } } } - + public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = 0; return true; } - + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (damage > npc.lifeMax / 2) - { - damage = 0; - return false; - } - double protection = CalamityWorld.death ? 0.05 : 0.08; - damage = (int)((double)damage * protection); - return true; + if (damage > npc.lifeMax / 2) + { + damage = 0; + return false; + } + double protection = CalamityWorld.death ? 0.05 : 0.075; + damage = (int)((double)damage * protection); + return true; } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage /= 2; - } - if (projectile.type == mod.ProjectileType("SulphuricAcidMist2")) - { - damage /= 8; - } - if (projectile.minion) - { - return; - } - if (projectile.penetrate == -1) //not a minion and penetrate is infinite - { - damage = (int)((double)damage * 0.2); - } - else if (projectile.penetrate > 3) //not a minion, penetrate is not infinite, penetrate is greater than 3 - { - damage = (int)((double)damage * 0.7); - } - else //not a minion, penetrate is not infinite, and penetrate is not greater than 1 - { - projectile.penetrate = 1; - } - } - - public override bool CheckActive() + public override bool CheckActive() { return false; } - + public override bool PreNPCLoot() { return false; } - + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) @@ -221,13 +195,13 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } } - + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); npc.damage = (int)(npc.damage * 0.8f); } - + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(mod.BuffType("GodSlayerInferno"), 240, true); diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs index 31c3321b6c..a5eb849303 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods } else { - npc.damage = 300; + npc.damage = Main.expertMode ? 260 : 130; npc.dontTakeDamage = false; } if (!Main.npc[(int)npc.ai[1]].active) @@ -89,12 +89,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (damage > npc.lifeMax / 2) - { - damage = 0; - return false; - } - damage = (int)((double)damage * 0.66f); + damage = (int)((double)damage * 0.5); return true; } diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs index 5759189837..633612ca30 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs @@ -10,17 +10,16 @@ using CalamityMod.Projectiles; namespace CalamityMod.NPCs.TheDevourerofGods { - [AutoloadBossHead] - public class DevourerofGodsBodyS : ModNPC + [AutoloadBossHead] + public class DevourerofGodsBodyS : ModNPC { - public double damageTaken = 0.0; - public int invinceTime = 360; + private int invinceTime = 360; public override void SetStaticDefaults() { DisplayName.SetDefault("The Devourer of Gods"); } - + public override void SetDefaults() { npc.damage = 220; //70 @@ -28,24 +27,26 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.width = 54; //34 npc.height = 54; //34 npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 937500 : 825000; //720000 672000 + npc.lifeMax = CalamityWorld.revenge ? 1875000 : 1650000; //720000 672000 if (CalamityWorld.death) { - npc.lifeMax = 1530000; + npc.lifeMax = 3060000; } if (CalamityWorld.bossRushActive) - { - npc.lifeMax = CalamityWorld.death ? 5000000 : 4600000; - } - npc.aiStyle = -1; //new - aiType = -1; //new - animationType = 10; //new + { + npc.lifeMax = CalamityWorld.death ? 10000000 : 9200000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = -1; //new + aiType = -1; //new + animationType = 10; //new npc.knockBackResist = 0f; npc.alpha = 255; npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; - npc.chaseable = false; + npc.chaseable = false; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; @@ -55,375 +56,337 @@ namespace CalamityMod.NPCs.TheDevourerofGods { npc.buffImmune[k] = true; } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - else - music = MusicID.LunarBoss; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); + else + music = MusicID.LunarBoss; npc.dontCountMe = true; } - + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { return false; } - public override void BossHeadRotation(ref float rotation) - { - rotation = npc.rotation; - } - - public override void AI() + public override void BossHeadRotation(ref float rotation) { - bool expertMode = Main.expertMode; - bool speedBoost1 = (double)npc.life <= (double)npc.lifeMax * 0.8; //speed increase - bool speedBoost2 = (double)npc.life <= (double)npc.lifeMax * 0.6; //speed increase - bool speedBoost3 = (double)npc.life <= (double)npc.lifeMax * 0.4; //speed increase - bool speedBoost4 = (double)npc.life <= (double)npc.lifeMax * 0.2; //speed increase - 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); - if (invinceTime > 0) - { - invinceTime--; - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS"))) - { - npc.active = false; - } - if (Main.npc[(int)npc.ai[2]].localAI[3] >= 1f) - { - npc.damage = 0; - npc.alpha = Main.npc[(int)npc.ai[2]].alpha; - } - else if (Main.npc[(int)npc.ai[1]].alpha < 128) + rotation = npc.rotation; + } + + public override void AI() + { + bool expertMode = Main.expertMode; + bool speedBoost1 = (double)npc.life <= (double)npc.lifeMax * 0.8; //speed increase + bool speedBoost2 = (double)npc.life <= (double)npc.lifeMax * 0.6; //speed increase + bool speedBoost3 = (double)npc.life <= (double)npc.lifeMax * 0.4; //speed increase + bool speedBoost4 = (double)npc.life <= (double)npc.lifeMax * 0.2; //speed increase + 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); + if (invinceTime > 0) + { + invinceTime--; + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (!Main.npc[CalamityGlobalNPC.DoGHead].active) + { + npc.active = false; + } + if (Main.npc[(int)npc.ai[2]].localAI[3] >= 1f) + { + npc.alpha = Main.npc[(int)npc.ai[2]].alpha; + } + else if (Main.npc[(int)npc.ai[1]].alpha < 128) { npc.alpha -= 42; if (npc.alpha <= 0 && invinceTime <= 0) { - npc.damage = expertMode ? 352 : 220; - npc.alpha = 0; + npc.alpha = 0; } } - float fallSpeed = 16f; - float turnSpeed = 0.3f; - float speed = fallSpeed; - if (Main.npc[(int)npc.ai[2]].ai[2] == 0f) - { - if (speedBoost4 || CalamityWorld.death) - { - speed = 26f; - turnSpeed = 0.53f; - } - else if (speedBoost3) - { - speed = 21.5f; - turnSpeed = 0.43f; - } - else if (speedBoost2) - { - speed = 20.5f; - turnSpeed = 0.39f; - } - else if (speedBoost1) - { - speed = 19f; - turnSpeed = 0.36f; - } - } - else - { - turnSpeed = 0.2f; - if (speedBoost4 || CalamityWorld.death) - { - turnSpeed = 0.4f; - speed = 28f; - } - else if (speedBoost3) - { - turnSpeed = 0.29f; - speed = 22f; - } - else if (speedBoost2) - { - turnSpeed = 0.25f; - speed = 20f; - } - else if (speedBoost1) - { - turnSpeed = 0.22f; - speed = 18f; - } - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - else - { - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - } - + float fallSpeed = 16f; + float turnSpeed = 0.3f; + float speed = fallSpeed; + if (Main.npc[(int)npc.ai[2]].ai[2] == 0f) + { + if (speedBoost4 || CalamityWorld.death) + { + speed = 26f; + turnSpeed = 0.53f; + } + else if (speedBoost3) + { + speed = 21.5f; + turnSpeed = 0.43f; + } + else if (speedBoost2) + { + speed = 20.5f; + turnSpeed = 0.39f; + } + else if (speedBoost1) + { + speed = 19f; + turnSpeed = 0.36f; + } + } + else + { + turnSpeed = 0.2f; + if (speedBoost4 || CalamityWorld.death) + { + turnSpeed = 0.4f; + speed = 28f; + } + else if (speedBoost3) + { + turnSpeed = 0.29f; + speed = 22f; + } + else if (speedBoost2) + { + turnSpeed = 0.25f; + speed = 20f; + } + else if (speedBoost1) + { + turnSpeed = 0.22f; + speed = 18f; + } + } + int num180 = (int)(npc.position.X / 16f) - 1; + int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num182 = (int)(npc.position.Y / 16f) - 1; + int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num180 < 0) + { + num180 = 0; + } + if (num181 > Main.maxTilesX) + { + num181 = Main.maxTilesX; + } + if (num182 < 0) + { + num182 = 0; + } + if (num183 > Main.maxTilesY) + { + num183 = Main.maxTilesY; + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } + catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + else + { + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } + } + } + } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; - return true; + cooldownSlot = 0; + return (npc.alpha == 0 && invinceTime <= 0); } - + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (damage > npc.lifeMax / 2) - { - damage = 0; - return false; - } - damageTaken += (crit ? (damage * 2) : damage); - double protection = CalamityWorld.death ? 0.01 : 0.015; - if (damageTaken >= 5000.0) - { - damage = (int)((double)damage * protection); - } - else - { - damage = (int)((double)damage * 0.1); - } - return true; + if (damage > npc.lifeMax / 2) + { + damage = 0; + return false; + } + double protection = CalamityWorld.death ? 0.03 : 0.045; + damage = (int)((double)damage * protection); + return true; } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (ProjectileID.Sets.StardustDragon[projectile.type]) - { - damage /= 2; - } - if (projectile.type == mod.ProjectileType("SulphuricAcidMist2")) - { - damage /= 8; - } - if (projectile.minion) - { - return; - } - if (projectile.penetrate == -1) //not a minion and penetrate is infinite - { - damage = (int)((double)damage * 0.15); - } - else if (projectile.penetrate > 3) //not a minion, penetrate is not infinite, penetrate is greater than 3 - { - damage = (int)((double)damage * 0.7); - } - else //not a minion, penetrate is not infinite, and penetrate is not greater than 1 - { - projectile.penetrate = 1; - } - } - - public override bool CheckActive() + public override bool CheckActive() { return false; } - + public override bool PreNPCLoot() { return false; } - + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) @@ -458,13 +421,13 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } } - + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); npc.damage = (int)(npc.damage * 0.8f); } - + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(mod.BuffType("GodSlayerInferno"), 240, true); diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs index 139b2da631..35f5e7be4c 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs @@ -19,19 +19,19 @@ namespace CalamityMod.NPCs.TheDevourerofGods [AutoloadBossHead] public class DevourerofGodsHead : ModNPC { - private bool tail = false; - private const int minLength = 100; - private const int maxLength = 101; - private bool halfLife = false; - private bool halfLife2 = false; - private int spawnDoGCountdown = 0; - private float phaseSwitch = 0f; - + private bool tail = false; + private const int minLength = 100; + private const int maxLength = 101; + private bool halfLife = false; + private bool halfLife2 = false; + private int spawnDoGCountdown = 0; + private float phaseSwitch = 0f; + public override void SetStaticDefaults() { DisplayName.SetDefault("The Devourer of Gods"); } - + public override void SetDefaults() { npc.damage = 250; //150 @@ -39,15 +39,17 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.width = 64; //324 npc.height = 76; //216 npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 500000 : 450000; //1000000 960000 - if (CalamityWorld.death) - { - npc.lifeMax = 850000; - } - npc.takenDamageMultiplier = 1.25f; + npc.lifeMax = CalamityWorld.revenge ? 500000 : 450000; //1000000 960000 + if (CalamityWorld.death) + { + npc.lifeMax = 850000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.takenDamageMultiplier = 1.25f; npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new + aiType = -1; //new + animationType = 10; //new npc.knockBackResist = 0f; npc.scale = 1.4f; npc.boss = true; @@ -56,41 +58,41 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - if (Main.expertMode) + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + if (Main.expertMode) { npc.scale = 1.5f; } } - + public override void AI() { - CalamityGlobalNPC.DoGHead = npc.whoAmI; - float playerRunAcceleration = Main.player[npc.target].velocity.Y == 0f ? Math.Abs(Main.player[npc.target].moveSpeed * 0.3f) : (Main.player[npc.target].runAcceleration * 0.8f); + CalamityGlobalNPC.DoGHead = npc.whoAmI; + float playerRunAcceleration = Main.player[npc.target].velocity.Y == 0f ? Math.Abs(Main.player[npc.target].moveSpeed * 0.3f) : (Main.player[npc.target].runAcceleration * 0.8f); if (playerRunAcceleration <= 1f) { playerRunAcceleration = 1f; } - if (Main.raining) - { - Main.raining = false; - if (Main.netMode == 2) - { - NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); - } - } - Vector2 vector = npc.Center; + if (Main.raining) + { + Main.raining = false; + if (Main.netMode == 2) + { + NetMessage.SendData(7, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); + } + } + Vector2 vector = npc.Center; bool flies = npc.ai[2] == 0f; bool expertMode = Main.expertMode; bool speedBoost1 = (double)npc.life <= (double)npc.lifeMax * 0.8; //speed increase @@ -123,32 +125,32 @@ namespace CalamityMod.NPCs.TheDevourerofGods spawnDoGCountdown--; if (spawnDoGCountdown == 0 && Main.netMode != 1) { - for (int i = 0; i < 2; i++) - { - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("DevourerofGodsHead2")); - } + for (int i = 0; i < 2; i++) + { + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("DevourerofGodsHead2")); + } + } + } + } + else if (speedBoost2) + { + if (!halfLife2) + { + if (CalamityWorld.revenge) + { + spawnDoGCountdown = 10; + } + halfLife2 = true; + } + if (spawnDoGCountdown > 0) + { + spawnDoGCountdown--; + if (spawnDoGCountdown == 0 && Main.netMode != 1) + { + NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("DevourerofGodsHead2")); } } } - else if (speedBoost2) - { - if (!halfLife2) - { - if (CalamityWorld.revenge) - { - spawnDoGCountdown = 10; - } - halfLife2 = true; - } - if (spawnDoGCountdown > 0) - { - spawnDoGCountdown--; - if (spawnDoGCountdown == 0 && Main.netMode != 1) - { - NPC.SpawnOnPlayer(npc.FindClosestPlayer(), mod.NPCType("DevourerofGodsHead2")); - } - } - } 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); if (npc.ai[3] > 0f) { @@ -174,35 +176,35 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.alpha = 0; } if (Main.netMode != 1) - { - if (!tail && npc.ai[0] == 0f) + { + if (!tail && npc.ai[0] == 0f) { - int Previous = npc.whoAmI; + int Previous = npc.whoAmI; for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) - { - int segment = 0; - if (segmentSpawn >= 0 && segmentSpawn < minLength) - { - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsBody"), npc.whoAmI); - } - else - { - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsTail"), npc.whoAmI); - } - Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[2] = (float)npc.whoAmI; - Main.npc[segment].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)segment; + { + int segment = 0; + if (segmentSpawn >= 0 && segmentSpawn < minLength) + { + segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsBody"), npc.whoAmI); + } + else + { + segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsTail"), npc.whoAmI); + } + Main.npc[segment].realLife = npc.whoAmI; + Main.npc[segment].ai[2] = (float)npc.whoAmI; + Main.npc[segment].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)segment; npc.netUpdate = true; Previous = segment; } tail = true; - } - if (!npc.active && Main.netMode == 2) + } + if (!npc.active && Main.netMode == 2) { NetMessage.SendData(28, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - } + } if (Main.player[npc.target].dead) { flies = false; @@ -213,12 +215,12 @@ namespace CalamityMod.NPCs.TheDevourerofGods } if ((double)npc.position.Y > Main.rockLayer * 16.0) { - for (int a = 0; a < 200; a++) + for (int a = 0; a < 200; a++) { if (Main.npc[a].aiStyle == npc.aiStyle) { Main.npc[a].active = false; - } + } } } } @@ -242,51 +244,51 @@ namespace CalamityMod.NPCs.TheDevourerofGods { num183 = Main.maxTilesY; } - if (npc.ai[2] == 0f) + if (npc.ai[2] == 0f) { if (Main.netMode != 2) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) { - Main.player[Main.myPlayer].AddBuff(mod.BuffType("Warped"), 2); + Main.player[Main.myPlayer].AddBuff(mod.BuffType("Warped"), 2); } } phaseSwitch += 1f; npc.localAI[1] = 0f; - float speed = playerRunAcceleration * 15f; - float turnSpeed = playerRunAcceleration * 0.3f; - float homingSpeed = playerRunAcceleration * 18f; - float homingTurnSpeed = playerRunAcceleration * 0.33f; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE - { - phaseSwitch += 9f; - } - else if ((expertMode && speedBoost5) || CalamityWorld.death) - { - homingSpeed = playerRunAcceleration * 25f; - homingTurnSpeed = playerRunAcceleration * 0.52f; - } - else if (speedBoost4) - { - homingSpeed = playerRunAcceleration * 23f; - homingTurnSpeed = playerRunAcceleration * 0.47f; - } - else if (speedBoost3) - { - homingSpeed = playerRunAcceleration * 21.5f; - homingTurnSpeed = playerRunAcceleration * 0.43f; - } - else if (speedBoost2) - { - homingSpeed = playerRunAcceleration * 20.5f; - homingTurnSpeed = playerRunAcceleration * 0.39f; - } - else if (speedBoost1) - { - homingSpeed = playerRunAcceleration * 19f; - homingTurnSpeed = playerRunAcceleration * 0.36f; - } - float num188 = speed; + float speed = playerRunAcceleration * 15f; + float turnSpeed = playerRunAcceleration * 0.3f; + float homingSpeed = playerRunAcceleration * 18f; + float homingTurnSpeed = playerRunAcceleration * 0.33f; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE + { + phaseSwitch += 9f; + } + else if ((expertMode && speedBoost5) || CalamityWorld.death) + { + homingSpeed = playerRunAcceleration * 25f; + homingTurnSpeed = playerRunAcceleration * 0.52f; + } + else if (speedBoost4) + { + homingSpeed = playerRunAcceleration * 23f; + homingTurnSpeed = playerRunAcceleration * 0.47f; + } + else if (speedBoost3) + { + homingSpeed = playerRunAcceleration * 21.5f; + homingTurnSpeed = playerRunAcceleration * 0.43f; + } + else if (speedBoost2) + { + homingSpeed = playerRunAcceleration * 20.5f; + homingTurnSpeed = playerRunAcceleration * 0.39f; + } + else if (speedBoost1) + { + homingSpeed = playerRunAcceleration * 19f; + homingTurnSpeed = playerRunAcceleration * 0.36f; + } + float num188 = speed; float num189 = turnSpeed; Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); @@ -528,45 +530,45 @@ namespace CalamityMod.NPCs.TheDevourerofGods { if (Main.netMode != 2) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) - { - Main.player[Main.myPlayer].AddBuff(mod.BuffType("ExtremeGrav"), 2); - } - } + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) + { + Main.player[Main.myPlayer].AddBuff(mod.BuffType("ExtremeGrav"), 2); + } + } phaseSwitch += 1f; - float speed = playerRunAcceleration * 19f; - float turnSpeed = playerRunAcceleration * 0.28f; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE - { - speed = playerRunAcceleration * 80f; - turnSpeed = playerRunAcceleration * 1f; - } - else if ((expertMode && speedBoost5) || CalamityWorld.death) - { - speed = playerRunAcceleration * 26f; - turnSpeed = playerRunAcceleration * 0.45f; - } - else if (speedBoost4) - { - speed = playerRunAcceleration * 24.5f; - turnSpeed = playerRunAcceleration * 0.4f; - } - else if (speedBoost3) - { - speed = playerRunAcceleration * 23f; - turnSpeed = playerRunAcceleration * 0.36f; - } - else if (speedBoost2) - { - speed = playerRunAcceleration * 21.5f; - turnSpeed = playerRunAcceleration * 0.33f; - } - else if (speedBoost1) - { - speed = playerRunAcceleration * 20f; - turnSpeed = playerRunAcceleration * 0.3f; - } - if (!flies) + float speed = playerRunAcceleration * 19f; + float turnSpeed = playerRunAcceleration * 0.28f; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE + { + speed = playerRunAcceleration * 80f; + turnSpeed = playerRunAcceleration * 1f; + } + else if ((expertMode && speedBoost5) || CalamityWorld.death) + { + speed = playerRunAcceleration * 26f; + turnSpeed = playerRunAcceleration * 0.45f; + } + else if (speedBoost4) + { + speed = playerRunAcceleration * 24.5f; + turnSpeed = playerRunAcceleration * 0.4f; + } + else if (speedBoost3) + { + speed = playerRunAcceleration * 23f; + turnSpeed = playerRunAcceleration * 0.36f; + } + else if (speedBoost2) + { + speed = playerRunAcceleration * 21.5f; + turnSpeed = playerRunAcceleration * 0.33f; + } + else if (speedBoost1) + { + speed = playerRunAcceleration * 20f; + turnSpeed = playerRunAcceleration * 0.3f; + } + if (!flies) { for (int num952 = num180; num952 < num181; num952++) { @@ -612,11 +614,11 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } } - else - { - npc.localAI[1] = 0f; - } - float num188 = speed; + else + { + npc.localAI[1] = 0f; + } + float num188 = speed; float num189 = turnSpeed; Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); @@ -654,7 +656,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods if (!flies) { npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + turnSpeed; //turnspeed * 0.5f + npc.velocity.Y = npc.velocity.Y + turnSpeed; //turnspeed * 0.5f if (npc.velocity.Y > num188) //speed { npc.velocity.Y = num188; @@ -842,20 +844,26 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } } - + public override void BossLoot(ref string name, ref int potionType) { potionType = ItemID.None; } - + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (projectile.type == mod.ProjectileType("SulphuricAcidMist2")) - { - damage /= 8; - } - } - + if (projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("EidolicWail")) + { + damage /= 4; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { if (damage > npc.lifeMax / 2) @@ -873,21 +881,21 @@ namespace CalamityMod.NPCs.TheDevourerofGods damage = 0; return false; } - return true; + return true; } - + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { scale = 1.5f; return null; } - + public override bool CheckActive() { return false; } - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { @@ -918,20 +926,20 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } } - + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - + npc.damage = (int)(npc.damage * 0.8f); + } + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(mod.BuffType("GodSlayerInferno"), 300, true); if (CalamityWorld.death) { - player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); - } + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } int num = Main.rand.Next(5); string key = "Mods.CalamityMod.EdgyBossText3"; if (num == 0) diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs index 299edda666..d2c489eff8 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHead2.cs @@ -56,7 +56,8 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override void AI() { - float playerRunAcceleration = Main.player[npc.target].velocity.Y == 0f ? Math.Abs(Main.player[npc.target].moveSpeed * 0.3f) : (Main.player[npc.target].runAcceleration * 0.8f); + bool expertMode = Main.expertMode; + float playerRunAcceleration = Main.player[npc.target].velocity.Y == 0f ? Math.Abs(Main.player[npc.target].moveSpeed * 0.3f) : (Main.player[npc.target].runAcceleration * 0.8f); if (playerRunAcceleration <= 1f) { playerRunAcceleration = 1f; @@ -69,11 +70,10 @@ namespace CalamityMod.NPCs.TheDevourerofGods } else { - npc.damage = 600; + npc.damage = expertMode ? 360 : 180; npc.dontTakeDamage = false; } Vector2 vector = npc.Center; - bool expertMode = Main.expertMode; 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); if (npc.ai[3] > 0f) { @@ -443,7 +443,6 @@ namespace CalamityMod.NPCs.TheDevourerofGods if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) { npc.netUpdate = true; - return; } } @@ -452,15 +451,11 @@ namespace CalamityMod.NPCs.TheDevourerofGods potionType = ItemID.None; } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - if (damage > npc.lifeMax / 2) - { - damage = 0; - return false; - } - return true; - } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return true; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs index 3bb3cd9819..f28d1fcbc9 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs @@ -19,24 +19,23 @@ namespace CalamityMod.NPCs.TheDevourerofGods [AutoloadBossHead] public class DevourerofGodsHeadS : ModNPC { - private bool tail = false; - private const int minLength = 120; - private const int maxLength = 121; - private bool halfLife = false; - private int flameTimer = 900; - private int laserShoot = 0; - private float phaseSwitch = 0f; - private float[] shotSpacing = new float[4] { 1050f, 1050f, 1050f, 1050f }; - private const float spacingVar = 105; - private const int totalShots = 20; - private int idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; - private double damageTaken = 0.0; + private bool tail = false; + private const int minLength = 120; + private const int maxLength = 121; + private bool halfLife = false; + private int flameTimer = 900; + private int laserShoot = 0; + private float phaseSwitch = 0f; + private float[] shotSpacing = new float[4] { 1050f, 1050f, 1050f, 1050f }; + private const float spacingVar = 105; + private const int totalShots = 20; + private int idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("The Devourer of Gods"); } - + public override void SetDefaults() { npc.damage = 300; //150 @@ -44,19 +43,21 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.width = 100; //130 npc.height = 144; //150 npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 937500 : 825000; //720000 672000 + npc.lifeMax = CalamityWorld.revenge ? 1875000 : 1650000; //720000 672000 if (CalamityWorld.death) { - npc.lifeMax = 1530000; + npc.lifeMax = 3060000; } if (CalamityWorld.bossRushActive) { - npc.lifeMax = CalamityWorld.death ? 5000000 : 4600000; + npc.lifeMax = CalamityWorld.death ? 10000000 : 9200000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.takenDamageMultiplier = 1.25f; npc.aiStyle = -1; //new - aiType = -1; //new - animationType = 10; //new + aiType = -1; //new + animationType = 10; //new npc.knockBackResist = 0f; npc.scale = 1.1f; npc.boss = true; @@ -65,109 +66,98 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.behindTiles = true; npc.noGravity = true; npc.noTileCollide = true; - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - else - music = MusicID.LunarBoss; - bossBag = mod.ItemType("DevourerofGodsBag"); + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); + else + music = MusicID.LunarBoss; + bossBag = mod.ItemType("DevourerofGodsBag"); } - public override void BossHeadRotation(ref float rotation) - { - rotation = npc.rotation; - } - - public override void AI() + public override void BossHeadRotation(ref float rotation) { - CalamityGlobalNPC.DoGHead = npc.whoAmI; + rotation = npc.rotation; + } + + public override void AI() + { + CalamityGlobalNPC.DoGHead = npc.whoAmI; Vector2 vector = npc.Center; bool flies = npc.ai[2] == 0f; bool expertMode = Main.expertMode; bool speedBoost2 = (double)npc.life <= (double)npc.lifeMax * 0.6 || (CalamityWorld.bossRushActive && (double)npc.life <= (double)npc.lifeMax * 0.9); //speed increase bool speedBoost4 = (double)npc.life <= (double)npc.lifeMax * 0.2 && !CalamityWorld.bossRushActive; //speed increase - bool breathFireMore = (double)npc.life <= (double)npc.lifeMax * 0.1; - if (speedBoost2 && !speedBoost4) - { - if (npc.localAI[3] == 0f) - { - if (Main.netMode != 1) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 720f) - { - npc.localAI[2] = 0f; - npc.localAI[3] = 1f; - npc.netUpdate = true; - } - } - } - else if (npc.localAI[3] == 1f) - { - //npc.damage = 0; - npc.alpha += 4; - if (npc.alpha == 204) //255 - { - laserShoot = 0; - } - if (npc.alpha >= 204) //255 - { - npc.alpha = 204; //255 - idleCounter--; - if (idleCounter <= 0) - { - npc.localAI[3] = 2f; - idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; - npc.netUpdate = true; - } - } - } - else if (npc.localAI[3] == 2f) - { - npc.alpha -= 1; - if (npc.alpha <= 0) - { - if (flameTimer < 270) - { - flameTimer = 270; - } - //npc.damage = expertMode ? 480 : 300; - npc.alpha = 0; - npc.localAI[3] = 0f; - npc.netUpdate = true; - } - } - } - else - { - npc.alpha -= 6; - if (npc.alpha < 0) - { - npc.alpha = 0; - } - if (npc.localAI[3] > 0f) - { - //npc.damage = expertMode ? 480 : 300; - npc.localAI[3] = 0f; - npc.netUpdate = true; - } - } - if (npc.alpha <= 0) + bool breathFireMore = (double)npc.life <= (double)npc.lifeMax * 0.1; + if (speedBoost2 && !speedBoost4) { - npc.damage = expertMode ? 480 : 300; + if (npc.localAI[3] == 0f) //start laser wall phase + { + if (Main.netMode != 1) + { + npc.localAI[2] += 1f; + if (npc.localAI[2] >= 720f) + { + npc.localAI[2] = 0f; + npc.localAI[3] = 1f; + npc.netUpdate = true; + } + } + } + else if (npc.localAI[3] == 1f) //turn invisible and fire laser walls + { + npc.alpha += 4; + if (npc.alpha == 204) //255 + { + laserShoot = 0; + } + if (npc.alpha >= 204) //255 + { + npc.alpha = 204; //255 + idleCounter--; + if (idleCounter <= 0) + { + npc.localAI[3] = 2f; + idleCounter = (CalamityWorld.death || CalamityWorld.bossRushActive) ? 540 : 360; + npc.netUpdate = true; + } + } + } + else if (npc.localAI[3] == 2f) //turn visible + { + npc.alpha -= 1; + if (npc.alpha <= 0) + { + if (flameTimer < 270) + { + flameTimer = 270; + } + npc.alpha = 0; + npc.localAI[3] = 0f; + npc.netUpdate = true; + } + } } else { - npc.damage = 0; + npc.alpha -= 6; + if (npc.alpha < 0) + { + npc.alpha = 0; + } + if (npc.localAI[3] > 0f) + { + npc.localAI[3] = 0f; + npc.netUpdate = true; + } } - if (speedBoost4) + if (speedBoost4) { if (!halfLife) { @@ -194,252 +184,252 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.TargetClosest(true); } npc.velocity.Length(); - if (Main.netMode != 1) - { - if (!tail && npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) - { - int segment = 0; - if (segmentSpawn >= 0 && segmentSpawn < minLength) - { - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsBodyS"), npc.whoAmI); - } - else - { - segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsTailS"), npc.whoAmI); - } - Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[2] = (float)npc.whoAmI; - Main.npc[segment].ai[1] = (float)Previous; - Main.npc[Previous].ai[0] = (float)segment; - NetMessage.SendData(23, -1, -1, null, segment, 0f, 0f, 0f, 0); - Previous = segment; - } - tail = true; - } - int projectileDamage = expertMode ? 69 : 80; - if (npc.alpha <= 0 && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - if (flameTimer <= 0) - { - flameTimer = 900; - } - else - { - flameTimer--; - float num861 = 4f; - int num863 = 1; - if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - { - num863 = -1; - } - Vector2 vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num864 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + (float)(num863 * 180) - vector86.X; - float num865 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector86.Y; - float num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); - num866 = num861 / num866; - num864 *= num866; - num865 *= num866; - if (breathFireMore) - { - if (flameTimer <= 810 && flameTimer > 630) - { - if (npc.soundDelay == 0) - { - npc.soundDelay = 21; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); - } - if (npc.soundDelay % 3 == 0) - { - float num867 = 1f; - int num869 = mod.ProjectileType("DoGFire"); - vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num864 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector86.X; - num865 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector86.Y; - num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); - num866 = num867 / num866; - num864 *= num866; - num865 *= num866; - num865 += (float)Main.rand.Next(-10, 11) * 0.01f; - num864 += (float)Main.rand.Next(-10, 11) * 0.01f; - num865 += npc.velocity.Y * 0.75f; - num864 += npc.velocity.X * 0.75f; - vector86.X -= num864 * 1f; - vector86.Y -= num865 * 1f; - int damage = expertMode ? 56 : 64; - Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - else if (flameTimer <= 630) - { - if (npc.soundDelay == 0) - { - npc.soundDelay = 21; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); - } - if (npc.soundDelay % 3 == 0) - { - float num867 = 1f; - int num869 = mod.ProjectileType("DoGFire"); - vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num864 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector86.X; - num865 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector86.Y; - num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); - num866 = num867 / num866; - num864 *= num866; - num865 *= num866; - num865 += (float)Main.rand.Next(-10, 11) * 0.01f; - num864 += (float)Main.rand.Next(-10, 11) * 0.01f; - num865 += npc.velocity.Y * 0.75f; - num864 += npc.velocity.X * 0.75f; - vector86.X -= num864 * 1f; - vector86.Y -= num865 * 1f; - int damage = expertMode ? 56 : 64; - Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, damage, 0f, Main.myPlayer, 0f, 2f); - } - } - } - else - { - if (flameTimer <= 270 && flameTimer > 90) - { - if (npc.soundDelay == 0) - { - npc.soundDelay = 21; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); - } - if (npc.soundDelay % 3 == 0) - { - float num867 = 1f; - int num869 = mod.ProjectileType("DoGFire"); - vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num864 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector86.X; - num865 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector86.Y; - num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); - num866 = num867 / num866; - num864 *= num866; - num865 *= num866; - num865 += (float)Main.rand.Next(-10, 11) * 0.01f; - num864 += (float)Main.rand.Next(-10, 11) * 0.01f; - num865 += npc.velocity.Y * 0.75f; - num864 += npc.velocity.X * 0.75f; - vector86.X -= num864 * 1f; - vector86.Y -= num865 * 1f; - int damage = expertMode ? 56 : 64; - Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - else if (flameTimer <= 90) - { - if (npc.soundDelay == 0) - { - npc.soundDelay = 21; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); - } - if (npc.soundDelay % 3 == 0) - { - float num867 = 1f; - int num869 = mod.ProjectileType("DoGFire"); - vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num864 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector86.X; - num865 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector86.Y; - num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); - num866 = num867 / num866; - num864 *= num866; - num865 *= num866; - num865 += (float)Main.rand.Next(-10, 11) * 0.01f; - num864 += (float)Main.rand.Next(-10, 11) * 0.01f; - num865 += npc.velocity.Y * 0.75f; - num864 += npc.velocity.X * 0.75f; - vector86.X -= num864 * 1f; - vector86.Y -= num865 * 1f; - int damage = expertMode ? 56 : 64; - Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - } - if (!speedBoost4 && (npc.localAI[3] == 1f || npc.GetGlobalNPC(mod).enraged)) - { - laserShoot += 3; - if (laserShoot >= 2400) - { - laserShoot = 0; - } - float speed = (CalamityWorld.bossRushActive ? 4.5f : 4f); - if (laserShoot % (CalamityWorld.bossRushActive ? 210 : (CalamityWorld.death ? 240 : 300)) == 0) //300 600 900 1200 1500 1800 2100 2400 - { - Main.PlaySound(2, (int)Main.player[npc.target].position.X, (int)Main.player[npc.target].position.Y, 12); - float targetPosY = Main.player[npc.target].position.Y + (Main.rand.Next(2) == 0 ? 50f : 0f); - int extraLasers = Main.rand.Next(2); - for (int x = 0; x < totalShots; x++) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + 1000f, targetPosY + this.shotSpacing[0], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + this.shotSpacing[0], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - this.shotSpacing[0] -= spacingVar; //105 - } - if (extraLasers == 1 && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) - { - for (int x = 0; x < 10; x++) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + 1000f, targetPosY + this.shotSpacing[3], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + this.shotSpacing[3], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - this.shotSpacing[3] -= (Main.rand.Next(2) == 0 ? 180f : 200f); - } - this.shotSpacing[3] = 1050f; - } - this.shotSpacing[0] = 1050f; - } - if (laserShoot % (CalamityWorld.bossRushActive ? 300 : (CalamityWorld.death ? 360 : 450)) == 0) //480 960 1440 1920 2400 - { - for (int x = 0; x < totalShots; x++) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + this.shotSpacing[1], Main.player[npc.target].position.Y + 1000f, 0f, -speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - this.shotSpacing[1] -= spacingVar; //105 - } - this.shotSpacing[1] = 1050f; - } - if (laserShoot % (CalamityWorld.bossRushActive ? 420 : (CalamityWorld.death ? 480 : 600)) == 0) //600 1200 1800 2400 - { - for (int x = 0; x < totalShots; x++) - { - Projectile.NewProjectile(Main.player[npc.target].position.X + this.shotSpacing[2], Main.player[npc.target].position.Y - 1000f, 0f, speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - this.shotSpacing[2] -= spacingVar; //105 - } - this.shotSpacing[2] = 1050f; - } - } - } - if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsTailS"))) - { - npc.active = false; - } - float fallSpeed = 16f; - if (Main.player[npc.target].dead) + if (Main.netMode != 1) { - flies = false; - npc.velocity.Y = npc.velocity.Y + 2f; - if ((double)npc.position.Y > Main.worldSurface * 16.0) - { - npc.velocity.Y = npc.velocity.Y + 2f; - fallSpeed = 32f; - } - if ((double)npc.position.Y > Main.rockLayer * 16.0) + if (!tail && npc.ai[0] == 0f) { - for (int a = 0; a < 200; a++) + int Previous = npc.whoAmI; + for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++) { - if (Main.npc[a].type == mod.NPCType("DevourerofGodsHeadS") || Main.npc[a].type == mod.NPCType("DevourerofGodsBodyS") || - Main.npc[a].type == mod.NPCType("DevourerofGodsTailS")) + int segment = 0; + if (segmentSpawn >= 0 && segmentSpawn < minLength) { - Main.npc[a].active = false; - } + segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsBodyS"), npc.whoAmI); + } + else + { + segment = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), mod.NPCType("DevourerofGodsTailS"), npc.whoAmI); + } + Main.npc[segment].realLife = npc.whoAmI; + Main.npc[segment].ai[2] = (float)npc.whoAmI; + Main.npc[segment].ai[1] = (float)Previous; + Main.npc[Previous].ai[0] = (float)segment; + NetMessage.SendData(23, -1, -1, null, segment, 0f, 0f, 0f, 0); + Previous = segment; + } + tail = true; + } + int projectileDamage = expertMode ? 69 : 80; + if (npc.alpha <= 0 && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + if (flameTimer <= 0) + { + flameTimer = 900; + } + else + { + flameTimer--; + float num861 = 4f; + int num863 = 1; + if (npc.position.X + (float)(npc.width / 2) < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) + { + num863 = -1; + } + Vector2 vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num864 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) + (float)(num863 * 180) - vector86.X; + float num865 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector86.Y; + float num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); + num866 = num861 / num866; + num864 *= num866; + num865 *= num866; + if (breathFireMore) + { + if (flameTimer <= 810 && flameTimer > 630) + { + if (npc.soundDelay == 0) + { + npc.soundDelay = 21; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); + } + if (npc.soundDelay % 3 == 0) + { + float num867 = 1f; + int num869 = mod.ProjectileType("DoGFire"); + vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num864 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector86.X; + num865 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector86.Y; + num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); + num866 = num867 / num866; + num864 *= num866; + num865 *= num866; + num865 += (float)Main.rand.Next(-10, 11) * 0.01f; + num864 += (float)Main.rand.Next(-10, 11) * 0.01f; + num865 += npc.velocity.Y * 0.75f; + num864 += npc.velocity.X * 0.75f; + vector86.X -= num864 * 1f; + vector86.Y -= num865 * 1f; + int damage = expertMode ? 56 : 64; + Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + else if (flameTimer <= 630) + { + if (npc.soundDelay == 0) + { + npc.soundDelay = 21; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); + } + if (npc.soundDelay % 3 == 0) + { + float num867 = 1f; + int num869 = mod.ProjectileType("DoGFire"); + vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num864 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector86.X; + num865 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector86.Y; + num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); + num866 = num867 / num866; + num864 *= num866; + num865 *= num866; + num865 += (float)Main.rand.Next(-10, 11) * 0.01f; + num864 += (float)Main.rand.Next(-10, 11) * 0.01f; + num865 += npc.velocity.Y * 0.75f; + num864 += npc.velocity.X * 0.75f; + vector86.X -= num864 * 1f; + vector86.Y -= num865 * 1f; + int damage = expertMode ? 56 : 64; + Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, damage, 0f, Main.myPlayer, 0f, 2f); + } + } + } + else + { + if (flameTimer <= 270 && flameTimer > 90) + { + if (npc.soundDelay == 0) + { + npc.soundDelay = 21; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); + } + if (npc.soundDelay % 3 == 0) + { + float num867 = 1f; + int num869 = mod.ProjectileType("DoGFire"); + vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num864 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector86.X; + num865 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector86.Y; + num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); + num866 = num867 / num866; + num864 *= num866; + num865 *= num866; + num865 += (float)Main.rand.Next(-10, 11) * 0.01f; + num864 += (float)Main.rand.Next(-10, 11) * 0.01f; + num865 += npc.velocity.Y * 0.75f; + num864 += npc.velocity.X * 0.75f; + vector86.X -= num864 * 1f; + vector86.Y -= num865 * 1f; + int damage = expertMode ? 56 : 64; + Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + else if (flameTimer <= 90) + { + if (npc.soundDelay == 0) + { + npc.soundDelay = 21; + Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 109); + } + if (npc.soundDelay % 3 == 0) + { + float num867 = 1f; + int num869 = mod.ProjectileType("DoGFire"); + vector86 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num864 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector86.X; + num865 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector86.Y; + num866 = (float)Math.Sqrt((double)(num864 * num864 + num865 * num865)); + num866 = num867 / num866; + num864 *= num866; + num865 *= num866; + num865 += (float)Main.rand.Next(-10, 11) * 0.01f; + num864 += (float)Main.rand.Next(-10, 11) * 0.01f; + num865 += npc.velocity.Y * 0.75f; + num864 += npc.velocity.X * 0.75f; + vector86.X -= num864 * 1f; + vector86.Y -= num865 * 1f; + int damage = expertMode ? 56 : 64; + Projectile.NewProjectile(vector86.X, vector86.Y, num864, num865, num869, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + } + if (!speedBoost4 && (npc.localAI[3] == 1f || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive))) + { + laserShoot += 3; + if (laserShoot >= 2400) + { + laserShoot = 0; + } + float speed = (CalamityWorld.bossRushActive ? 4.5f : 4f); + if (laserShoot % (CalamityWorld.bossRushActive ? 210 : (CalamityWorld.death ? 240 : 300)) == 0) //300 600 900 1200 1500 1800 2100 2400 + { + Main.PlaySound(2, (int)Main.player[npc.target].position.X, (int)Main.player[npc.target].position.Y, 12); + float targetPosY = Main.player[npc.target].position.Y + (Main.rand.Next(2) == 0 ? 50f : 0f); + int extraLasers = Main.rand.Next(2); + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + 1000f, targetPosY + this.shotSpacing[0], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + this.shotSpacing[0], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + this.shotSpacing[0] -= spacingVar; //105 + } + if (extraLasers == 1 && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) + { + for (int x = 0; x < 10; x++) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + 1000f, targetPosY + this.shotSpacing[3], -speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Main.player[npc.target].position.X - 1000f, targetPosY + this.shotSpacing[3], speed, 0f, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + this.shotSpacing[3] -= (Main.rand.Next(2) == 0 ? 180f : 200f); + } + this.shotSpacing[3] = 1050f; + } + this.shotSpacing[0] = 1050f; + } + if (laserShoot % (CalamityWorld.bossRushActive ? 300 : (CalamityWorld.death ? 360 : 450)) == 0) //480 960 1440 1920 2400 + { + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + this.shotSpacing[1], Main.player[npc.target].position.Y + 1000f, 0f, -speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + this.shotSpacing[1] -= spacingVar; //105 + } + this.shotSpacing[1] = 1050f; + } + if (laserShoot % (CalamityWorld.bossRushActive ? 420 : (CalamityWorld.death ? 480 : 600)) == 0) //600 1200 1800 2400 + { + for (int x = 0; x < totalShots; x++) + { + Projectile.NewProjectile(Main.player[npc.target].position.X + this.shotSpacing[2], Main.player[npc.target].position.Y - 1000f, 0f, speed, mod.ProjectileType("DoGDeath"), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + this.shotSpacing[2] -= spacingVar; //105 + } + this.shotSpacing[2] = 1050f; } } } - int num180 = (int)(npc.position.X / 16f) - 1; + if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsTailS"))) + { + npc.active = false; + } + float fallSpeed = 16f; + if (Main.player[npc.target].dead) + { + flies = false; + npc.velocity.Y = npc.velocity.Y + 2f; + if ((double)npc.position.Y > Main.worldSurface * 16.0) + { + npc.velocity.Y = npc.velocity.Y + 2f; + fallSpeed = 32f; + } + if ((double)npc.position.Y > Main.rockLayer * 16.0) + { + for (int a = 0; a < 200; a++) + { + if (Main.npc[a].type == mod.NPCType("DevourerofGodsHeadS") || Main.npc[a].type == mod.NPCType("DevourerofGodsBodyS") || + Main.npc[a].type == mod.NPCType("DevourerofGodsTailS")) + { + Main.npc[a].active = false; + } + } + } + } + int num180 = (int)(npc.position.X / 16f) - 1; int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; int num182 = (int)(npc.position.Y / 16f) - 1; int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; @@ -459,34 +449,34 @@ namespace CalamityMod.NPCs.TheDevourerofGods { num183 = Main.maxTilesY; } - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - if (npc.ai[2] == 0f) + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + if (npc.ai[2] == 0f) { if (Main.netMode != 2) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) - { - Main.player[Main.myPlayer].AddBuff(mod.BuffType("Warped"), 2); - } - } + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) + { + Main.player[Main.myPlayer].AddBuff(mod.BuffType("Warped"), 2); + } + } phaseSwitch += 1f; npc.localAI[1] = 0f; - float speed = 15f; - float turnSpeed = 0.4f; - float homingSpeed = 24f; - float homingTurnSpeed = 0.5f; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE - { - phaseSwitch += 9f; - } - float num188 = speed; + float speed = 15f; + float turnSpeed = 0.4f; + float homingSpeed = 24f; + float homingTurnSpeed = 0.5f; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE + { + phaseSwitch += 9f; + } + float num188 = speed; float num189 = turnSpeed; Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); @@ -529,12 +519,12 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } } - else - { - num188 = homingSpeed; - num189 = homingTurnSpeed; - } - float num48 = num188 * 1.3f; + else + { + num188 = homingSpeed; + num189 = homingTurnSpeed; + } + float num48 = num188 * 1.3f; float num49 = num188 * 0.7f; float num50 = npc.velocity.Length(); if (num50 > 0f) @@ -611,55 +601,55 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } else { - if (npc.velocity.Y > fallSpeed * 0.5f) - { - npc.velocity.Y = fallSpeed * 0.5f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 0.3) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; - } - else - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; - } - } - else if (npc.velocity.Y == fallSpeed) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - else if (npc.velocity.Y > 4f) - { - if (npc.velocity.X < 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 0.9f; - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 0.9f; - } - } - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.velocity.Y > fallSpeed * 0.5f) + { + npc.velocity.Y = fallSpeed * 0.5f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)fallSpeed * 0.3) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; + } + else + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; + } + } + else if (npc.velocity.Y == fallSpeed) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + else if (npc.velocity.Y > 4f) + { + if (npc.velocity.X < 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 0.9f; + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 0.9f; + } + } + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); float num196 = System.Math.Abs(num191); float num197 = System.Math.Abs(num192); float num198 = num188 / num193; @@ -773,23 +763,23 @@ namespace CalamityMod.NPCs.TheDevourerofGods { if (Main.netMode != 2) { - if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) - { - Main.player[Main.myPlayer].AddBuff(mod.BuffType("ExtremeGrav"), 2); - } - } + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, vector) < 5600f) + { + Main.player[Main.myPlayer].AddBuff(mod.BuffType("ExtremeGrav"), 2); + } + } phaseSwitch += 1f; - float turnSpeed = 0.3f; - bool increaseSpeed = Vector2.Distance(Main.player[npc.target].Center, vector) > 3200f; - if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE - { - turnSpeed = 1.5f; - } - else if (increaseSpeed) - { - turnSpeed = 1f; - } - if (!flies) + float turnSpeed = 0.3f; + bool increaseSpeed = Vector2.Distance(Main.player[npc.target].Center, vector) > 3200f; + if (Vector2.Distance(Main.player[npc.target].Center, vector) > 5600f) //RAGE + { + turnSpeed = 1.5f; + } + else if (increaseSpeed) + { + turnSpeed = 1f; + } + if (!flies) { for (int num952 = num180; num952 < num181; num952++) { @@ -814,10 +804,10 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.localAI[1] = 1f; Rectangle rectangle12 = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); int num954 = 1200; - if ((double)npc.life <= (double)npc.lifeMax * 0.8 && (double)npc.life > (double)npc.lifeMax * 0.2) - { - num954 = 1400; - } + if ((double)npc.life <= (double)npc.lifeMax * 0.8 && (double)npc.life > (double)npc.lifeMax * 0.2) + { + num954 = 1400; + } bool flag95 = true; if (npc.position.Y > Main.player[npc.target].position.Y) { @@ -839,11 +829,11 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } } - else - { - npc.localAI[1] = 0f; - } - float num189 = turnSpeed; + else + { + npc.localAI[1] = 0f; + } + float num189 = turnSpeed; Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); @@ -874,21 +864,21 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.velocity = Vector2.Zero; npc.position.X = npc.position.X + num191; npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } else { if (!flies) { npc.TargetClosest(true); - npc.velocity.Y = npc.velocity.Y + turnSpeed; //turnspeed * 0.5f + npc.velocity.Y = npc.velocity.Y + turnSpeed; //turnspeed * 0.5f if (npc.velocity.Y > fallSpeed) { npc.velocity.Y = fallSpeed; @@ -929,119 +919,119 @@ namespace CalamityMod.NPCs.TheDevourerofGods } else { - double maximumSpeed1 = increaseSpeed ? 1.2 : 0.4; - double maximumSpeed2 = increaseSpeed ? 3.0 : 1.0; - num193 = (float)Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num25 = Math.Abs(num191); - float num26 = Math.Abs(num192); - float num27 = fallSpeed / num193; - num191 *= num27; - num192 *= num27; - if (((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f)) && ((npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + turnSpeed * 1.5f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - turnSpeed * 1.5f; - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + turnSpeed * 1.5f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - turnSpeed * 1.5f; - } - } - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + turnSpeed; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - turnSpeed; - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + turnSpeed; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - turnSpeed; - } - if ((double)Math.Abs(num192) < (double)fallSpeed * maximumSpeed1 /*0.2*/ && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + turnSpeed * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - turnSpeed * 2f; - } - } - if ((double)Math.Abs(num191) < (double)fallSpeed * maximumSpeed1 /*0.2*/ && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + turnSpeed * 2f; - } - else - { - npc.velocity.X = npc.velocity.X - turnSpeed * 2f; - } - } - } - else if (num25 > num26) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + turnSpeed * 1.1f; - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - turnSpeed * 1.1f; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) //0.5 - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + turnSpeed; - } - else - { - npc.velocity.Y = npc.velocity.Y - turnSpeed; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + turnSpeed * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - turnSpeed * 1.1f; - } - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) //0.5 - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + turnSpeed; - } - else - { - npc.velocity.X = npc.velocity.X - turnSpeed; - } - } - } - } + double maximumSpeed1 = increaseSpeed ? 1.2 : 0.4; + double maximumSpeed2 = increaseSpeed ? 3.0 : 1.0; + num193 = (float)Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num25 = Math.Abs(num191); + float num26 = Math.Abs(num192); + float num27 = fallSpeed / num193; + num191 *= num27; + num192 *= num27; + if (((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f)) && ((npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f))) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + turnSpeed * 1.5f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - turnSpeed * 1.5f; + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + turnSpeed * 1.5f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - turnSpeed * 1.5f; + } + } + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + turnSpeed; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - turnSpeed; + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + turnSpeed; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - turnSpeed; + } + if ((double)Math.Abs(num192) < (double)fallSpeed * maximumSpeed1 /*0.2*/ && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + turnSpeed * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - turnSpeed * 2f; + } + } + if ((double)Math.Abs(num191) < (double)fallSpeed * maximumSpeed1 /*0.2*/ && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + turnSpeed * 2f; + } + else + { + npc.velocity.X = npc.velocity.X - turnSpeed * 2f; + } + } + } + else if (num25 > num26) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + turnSpeed * 1.1f; + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - turnSpeed * 1.1f; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) //0.5 + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + turnSpeed; + } + else + { + npc.velocity.Y = npc.velocity.Y - turnSpeed; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + turnSpeed * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - turnSpeed * 1.1f; + } + if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)fallSpeed * maximumSpeed2) //0.5 + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + turnSpeed; + } + else + { + npc.velocity.X = npc.velocity.X - turnSpeed; + } + } + } + } } npc.rotation = (float)System.Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X) + 1.57f; if (flies) @@ -1074,20 +1064,26 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } } - + public override void BossLoot(ref string name, ref int potionType) { potionType = mod.ItemType("CosmiliteBrick"); } - + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (projectile.type == mod.ProjectileType("SulphuricAcidMist2")) - { - damage /= 8; - } - } - + if (projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("EidolicWail")) + { + damage /= 4; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + return npc.alpha == 0; + } + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { if (damage > npc.lifeMax / 2) @@ -1105,34 +1101,27 @@ namespace CalamityMod.NPCs.TheDevourerofGods damage = 0; return false; } - double multiplier = 1.0; - damageTaken += (crit ? (damage * 2) : damage); - damage = (int)((double)damage * multiplier); - if (damageTaken >= 50000.0) - { - damage = (int)((double)damage * 0.5); - } - return true; + return true; } - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { scale = 2f; return null; } - + public override bool CheckActive() { return false; } - + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS2"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS2"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); npc.position.Y = npc.position.Y + (float)(npc.height / 2); npc.width = 50; npc.height = 50; @@ -1158,20 +1147,20 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } } - + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); - npc.damage = (int)(npc.damage * 0.8f); - } - + npc.damage = (int)(npc.damage * 0.8f); + } + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(mod.BuffType("GodSlayerInferno"), 300, true); if ((CalamityWorld.death || CalamityWorld.bossRushActive) && npc.alpha <= 0) { - player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); - } + player.KillMe(PlayerDeathReason.ByOther(10), 1000.0, 0, false); + } int num = Main.rand.Next(5); string key = "Mods.CalamityMod.EdgyBossText3"; if (num == 0) diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail.cs b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs index 411b5d709c..d02335d69e 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs @@ -14,11 +14,11 @@ namespace CalamityMod.NPCs.TheDevourerofGods [AutoloadBossHead] public class DevourerofGodsTail : ModNPC { - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("The Devourer of Gods"); } - + public override void SetDefaults() { npc.damage = 150; @@ -26,14 +26,16 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.width = 32; //42 npc.height = 50; //42 npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 500000 : 450000; //1000000 960000 - if (CalamityWorld.death) - { - npc.lifeMax = 850000; - } - npc.aiStyle = 6; //new - aiType = -1; //new - animationType = 10; //new + npc.lifeMax = CalamityWorld.revenge ? 500000 : 450000; //1000000 960000 + if (CalamityWorld.death) + { + npc.lifeMax = 850000; + } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.aiStyle = 6; //new + aiType = -1; //new + animationType = 10; //new npc.knockBackResist = 0f; npc.scale = 1.4f; npc.alpha = 255; @@ -42,40 +44,40 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.noTileCollide = true; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; npc.boss = true; npc.takenDamageMultiplier = 1.25f; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); - else - music = MusicID.Boss3; - npc.dontCountMe = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); + else + music = MusicID.Boss3; + npc.dontCountMe = true; if (Main.expertMode) { npc.scale = 1.5f; } } - + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { return false; } - + public override void AI() { 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); if (!Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.active = false; - } + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.active = false; + } if (Main.npc[(int)npc.ai[1]].alpha < 128) { if (npc.alpha != 0) @@ -95,21 +97,21 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) + public override bool CanHitPlayer(Player target, ref int cooldownSlot) { - cooldownSlot = 1; + cooldownSlot = 0; return true; } - + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (projectile.type == mod.ProjectileType("SulphuricAcidMist2")) - { - damage /= 8; - } - } + if (projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("EidolicWail")) + { + damage /= 4; + } + } - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { @@ -140,7 +142,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } } - + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { if (damage > npc.lifeMax / 2) @@ -148,25 +150,25 @@ namespace CalamityMod.NPCs.TheDevourerofGods damage = 0; return false; } - return true; + return true; } - + public override bool CheckActive() { return false; } - + public override bool PreNPCLoot() { return false; } - + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); npc.damage = (int)(npc.damage * 0.8f); } - + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); @@ -192,5 +194,5 @@ namespace CalamityMod.NPCs.TheDevourerofGods player.AddBuff(BuffID.Frostburn, 180, true); player.AddBuff(BuffID.Darkness, 180, true); } - } + } } \ No newline at end of file diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs b/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs index 3fd0d302f3..091a24c764 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTail2.cs @@ -63,7 +63,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods } else { - npc.damage = 200; + npc.damage = Main.expertMode ? 200 : 100; npc.dontTakeDamage = false; } if (!Main.npc[(int)npc.ai[1]].active) @@ -130,16 +130,6 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - if (damage > npc.lifeMax / 2) - { - damage = 0; - return false; - } - return true; - } - public override bool CheckActive() { return false; diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs index 78f67f51d6..09f6d319a1 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs @@ -11,18 +11,17 @@ using CalamityMod.Projectiles; namespace CalamityMod.NPCs.TheDevourerofGods { - [AutoloadBossHead] - public class DevourerofGodsTailS : ModNPC + [AutoloadBossHead] + public class DevourerofGodsTailS : ModNPC { - public float beamPortal = 0f; - public double damageTaken = 0.0; - public int invinceTime = 360; + private float beamPortal = 0f; + private int invinceTime = 360; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("The Devourer of Gods"); } - + public override void SetDefaults() { npc.damage = 180; @@ -30,19 +29,21 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.width = 80; //90 npc.height = 98; //90 npc.defense = 0; - npc.lifeMax = CalamityWorld.revenge ? 937500 : 825000; //720000 672000 - if (CalamityWorld.death) - { - npc.lifeMax = 1530000; - } + npc.lifeMax = CalamityWorld.revenge ? 1875000 : 1650000; //720000 672000 + if (CalamityWorld.death) + { + npc.lifeMax = 3060000; + } if (CalamityWorld.bossRushActive) { - npc.lifeMax = CalamityWorld.death ? 5000000 : 4600000; + npc.lifeMax = CalamityWorld.death ? 10000000 : 9200000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.takenDamageMultiplier = 1.25f; - npc.aiStyle = -1; //new - aiType = -1; //new - animationType = 10; //new + npc.aiStyle = -1; //new + aiType = -1; //new + animationType = 10; //new npc.knockBackResist = 0f; npc.alpha = 255; npc.behindTiles = true; @@ -50,367 +51,365 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.noTileCollide = true; npc.canGhostHeal = false; npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.netAlways = true; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; npc.boss = true; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; } - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); - if (calamityModMusic != null) - music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); - else - music = MusicID.LunarBoss; - npc.dontCountMe = true; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + if (calamityModMusic != null) + music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse"); + else + music = MusicID.LunarBoss; + npc.dontCountMe = true; } - + public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { return false; } - public override void BossHeadRotation(ref float rotation) - { - rotation = npc.rotation; - } + public override void BossHeadRotation(ref float rotation) + { + rotation = npc.rotation; + } - public override void AI() + public override void AI() { bool expertMode = Main.expertMode; - bool speedBoost1 = (double)npc.life <= (double)npc.lifeMax * 0.8; //speed increase - bool speedBoost2 = (double)npc.life <= (double)npc.lifeMax * 0.6; //speed increase - bool speedBoost3 = (double)npc.life <= (double)npc.lifeMax * 0.4; //speed increase - bool speedBoost4 = (double)npc.life <= (double)npc.lifeMax * 0.2; //speed increase - if (invinceTime > 0) - { - invinceTime--; - npc.dontTakeDamage = true; - } - else - { - npc.dontTakeDamage = false; - } - if (npc.ai[3] > 0f) - { - npc.realLife = (int)npc.ai[3]; - } - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - npc.velocity.Length(); - if (npc.velocity.X < 0f) - { - npc.spriteDirection = -1; - } - else if (npc.velocity.X > 0f) - { - npc.spriteDirection = 1; - } - bool flag = false; - if (npc.ai[1] <= 0f) - { - flag = true; - } - else if (Main.npc[(int)npc.ai[1]].life <= 0) - { - flag = true; - } - if (flag) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - } - if (!NPC.AnyNPCs(mod.NPCType("DevourerofGodsHeadS"))) - { - npc.active = false; - } - if (Main.netMode != 1) - { - beamPortal += expertMode ? 2f : 1f; - if (beamPortal >= 1800f) - { - beamPortal = 0f; - npc.TargetClosest(true); - float projectileSpeed = 5f; - if (CalamityWorld.death) - { - projectileSpeed = 7f; - } - else if (CalamityWorld.revenge) - { - projectileSpeed = 6.5f; - } - else if (Main.expertMode) - { - projectileSpeed = 6f; - } - Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float playerPositionX = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - shootFromVector.X + (float)Main.rand.Next(-20, 21); - float playerPositionY = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - shootFromVector.Y + (float)Main.rand.Next(-20, 21); - float playerPosition = (float)Math.Sqrt((double)(playerPositionX * playerPositionX + playerPositionY * playerPositionY)); - playerPosition = projectileSpeed / playerPosition; - playerPositionX *= playerPosition; - playerPositionY *= playerPosition; - playerPositionX += (float)Main.rand.Next(-10, 11) * 0.05f; - playerPositionY += (float)Main.rand.Next(-10, 11) * 0.05f; - int projectileType = mod.ProjectileType("DoGBeamPortal"); - shootFromVector.X += playerPositionX * 5f; - shootFromVector.Y += playerPositionY * 5f; - Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, playerPositionX, playerPositionY, projectileType, 0, 0f, Main.myPlayer, 0f, 0f); - npc.netUpdate = true; - } - } + bool speedBoost1 = (double)npc.life <= (double)npc.lifeMax * 0.8; //speed increase + bool speedBoost2 = (double)npc.life <= (double)npc.lifeMax * 0.6; //speed increase + bool speedBoost3 = (double)npc.life <= (double)npc.lifeMax * 0.4; //speed increase + bool speedBoost4 = (double)npc.life <= (double)npc.lifeMax * 0.2; //speed increase + if (invinceTime > 0) + { + invinceTime--; + npc.dontTakeDamage = true; + } + else + { + npc.dontTakeDamage = false; + } + if (npc.ai[3] > 0f) + { + npc.realLife = (int)npc.ai[3]; + } + if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) + { + npc.TargetClosest(true); + } + npc.velocity.Length(); + if (npc.velocity.X < 0f) + { + npc.spriteDirection = -1; + } + else if (npc.velocity.X > 0f) + { + npc.spriteDirection = 1; + } + bool flag = false; + if (npc.ai[1] <= 0f) + { + flag = true; + } + else if (Main.npc[(int)npc.ai[1]].life <= 0) + { + flag = true; + } + if (flag) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + } + if (!Main.npc[CalamityGlobalNPC.DoGHead].active) + { + npc.active = false; + } + if (Main.netMode != 1) + { + beamPortal += expertMode ? 2f : 1f; + if (beamPortal >= 1800f) + { + beamPortal = 0f; + npc.TargetClosest(true); + float projectileSpeed = 5f; + if (CalamityWorld.death) + { + projectileSpeed = 7f; + } + else if (CalamityWorld.revenge) + { + projectileSpeed = 6.5f; + } + else if (Main.expertMode) + { + projectileSpeed = 6f; + } + Vector2 shootFromVector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); + float playerPositionX = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - shootFromVector.X + (float)Main.rand.Next(-20, 21); + float playerPositionY = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - shootFromVector.Y + (float)Main.rand.Next(-20, 21); + float playerPosition = (float)Math.Sqrt((double)(playerPositionX * playerPositionX + playerPositionY * playerPositionY)); + playerPosition = projectileSpeed / playerPosition; + playerPositionX *= playerPosition; + playerPositionY *= playerPosition; + playerPositionX += (float)Main.rand.Next(-10, 11) * 0.05f; + playerPositionY += (float)Main.rand.Next(-10, 11) * 0.05f; + int projectileType = mod.ProjectileType("DoGBeamPortal"); + shootFromVector.X += playerPositionX * 5f; + shootFromVector.Y += playerPositionY * 5f; + Projectile.NewProjectile(shootFromVector.X, shootFromVector.Y, playerPositionX, playerPositionY, projectileType, 0, 0f, Main.myPlayer, 0f, 0f); + npc.netUpdate = true; + } + } 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); - if (Main.npc[(int)npc.ai[2]].localAI[3] >= 1f) - { - npc.damage = 0; - npc.alpha = Main.npc[(int)npc.ai[2]].alpha; - } - else if (Main.npc[(int)npc.ai[1]].alpha < 128) + if (Main.npc[(int)npc.ai[2]].localAI[3] >= 1f) + { + npc.alpha = Main.npc[(int)npc.ai[2]].alpha; + } + else if (Main.npc[(int)npc.ai[1]].alpha < 128) { npc.alpha -= 42; if (npc.alpha <= 0 && invinceTime <= 0) { - npc.damage = expertMode ? 288 : 180; - npc.alpha = 0; + npc.alpha = 0; + } + } + float fallSpeed = 16f; + float turnSpeed = 0.3f; + float speed = fallSpeed; + if (Main.npc[(int)npc.ai[2]].ai[2] == 0f) + { + if (speedBoost4 || CalamityWorld.death) + { + speed = 26f; + turnSpeed = 0.53f; + } + else if (speedBoost3) + { + speed = 21.5f; + turnSpeed = 0.43f; + } + else if (speedBoost2) + { + speed = 20.5f; + turnSpeed = 0.39f; + } + else if (speedBoost1) + { + speed = 19f; + turnSpeed = 0.36f; + } + } + else + { + turnSpeed = 0.2f; + if (speedBoost4 || CalamityWorld.death) + { + turnSpeed = 0.4f; + speed = 28f; + } + else if (speedBoost3) + { + turnSpeed = 0.29f; + speed = 22f; + } + else if (speedBoost2) + { + turnSpeed = 0.25f; + speed = 20f; + } + else if (speedBoost1) + { + turnSpeed = 0.22f; + speed = 18f; + } + } + int num180 = (int)(npc.position.X / 16f) - 1; + int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; + int num182 = (int)(npc.position.Y / 16f) - 1; + int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; + if (num180 < 0) + { + num180 = 0; + } + if (num181 > Main.maxTilesX) + { + num181 = Main.maxTilesX; + } + if (num182 < 0) + { + num182 = 0; + } + if (num183 > Main.maxTilesY) + { + num183 = Main.maxTilesY; + } + if (Main.player[npc.target].dead) + { + npc.TargetClosest(false); + } + float num188 = speed; + float num189 = turnSpeed; + Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); + float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); + num191 = (float)((int)(num191 / 16f) * 16); + num192 = (float)((int)(num192 / 16f) * 16); + vector18.X = (float)((int)(vector18.X / 16f) * 16); + vector18.Y = (float)((int)(vector18.Y / 16f) * 16); + num191 -= vector18.X; + num192 -= vector18.Y; + float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) + { + try + { + vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); + num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; + num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; + } + catch + { + } + npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + int num194 = npc.width; + num193 = (num193 - (float)num194) / num193; + num191 *= num193; + num192 *= num193; + npc.velocity = Vector2.Zero; + npc.position.X = npc.position.X + num191; + npc.position.Y = npc.position.Y + num192; + if (num191 < 0f) + { + npc.spriteDirection = -1; + } + else if (num191 > 0f) + { + npc.spriteDirection = 1; + } + } + else + { + num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); + float num196 = System.Math.Abs(num191); + float num197 = System.Math.Abs(num192); + float num198 = num188 / num193; + num191 *= num198; + num192 *= num198; + if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189; + } + } + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189 * 2f; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189 * 2f; + } + } + if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 + } + else + { + npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 + } + } + } + else + { + if (num196 > num197) + { + if (npc.velocity.X < num191) + { + npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 + } + else if (npc.velocity.X > num191) + { + npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.Y > 0f) + { + npc.velocity.Y = npc.velocity.Y + num189; + } + else + { + npc.velocity.Y = npc.velocity.Y - num189; + } + } + } + else + { + if (npc.velocity.Y < num192) + { + npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; + } + else if (npc.velocity.Y > num192) + { + npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; + } + if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) + { + if (npc.velocity.X > 0f) + { + npc.velocity.X = npc.velocity.X + num189; + } + else + { + npc.velocity.X = npc.velocity.X - num189; + } + } + } } } - float fallSpeed = 16f; - float turnSpeed = 0.3f; - float speed = fallSpeed; - if (Main.npc[(int)npc.ai[2]].ai[2] == 0f) - { - if (speedBoost4 || CalamityWorld.death) - { - speed = 26f; - turnSpeed = 0.53f; - } - else if (speedBoost3) - { - speed = 21.5f; - turnSpeed = 0.43f; - } - else if (speedBoost2) - { - speed = 20.5f; - turnSpeed = 0.39f; - } - else if (speedBoost1) - { - speed = 19f; - turnSpeed = 0.36f; - } - } - else - { - turnSpeed = 0.2f; - if (speedBoost4 || CalamityWorld.death) - { - turnSpeed = 0.4f; - speed = 28f; - } - else if (speedBoost3) - { - turnSpeed = 0.29f; - speed = 22f; - } - else if (speedBoost2) - { - turnSpeed = 0.25f; - speed = 20f; - } - else if (speedBoost1) - { - turnSpeed = 0.22f; - speed = 18f; - } - } - int num180 = (int)(npc.position.X / 16f) - 1; - int num181 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num182 = (int)(npc.position.Y / 16f) - 1; - int num183 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num180 < 0) - { - num180 = 0; - } - if (num181 > Main.maxTilesX) - { - num181 = Main.maxTilesX; - } - if (num182 < 0) - { - num182 = 0; - } - if (num183 > Main.maxTilesY) - { - num183 = Main.maxTilesY; - } - if (Main.player[npc.target].dead) - { - npc.TargetClosest(false); - } - float num188 = speed; - float num189 = turnSpeed; - Vector2 vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num191 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num192 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num191 = (float)((int)(num191 / 16f) * 16); - num192 = (float)((int)(num192 / 16f) * 16); - vector18.X = (float)((int)(vector18.X / 16f) * 16); - vector18.Y = (float)((int)(vector18.Y / 16f) * 16); - num191 -= vector18.X; - num192 -= vector18.Y; - float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector18 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num191 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector18.X; - num192 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y; - } - catch - { - } - npc.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f; - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - int num194 = npc.width; - num193 = (num193 - (float)num194) / num193; - num191 *= num193; - num192 *= num193; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + num191; - npc.position.Y = npc.position.Y + num192; - if (num191 < 0f) - { - npc.spriteDirection = -1; - } - else if (num191 > 0f) - { - npc.spriteDirection = 1; - } - } - else - { - num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192)); - float num196 = System.Math.Abs(num191); - float num197 = System.Math.Abs(num192); - float num198 = num188 / num193; - num191 *= num198; - num192 *= num198; - if ((npc.velocity.X > 0f && num191 > 0f) || (npc.velocity.X < 0f && num191 < 0f) || (npc.velocity.Y > 0f && num192 > 0f) || (npc.velocity.Y < 0f && num192 < 0f)) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189; - } - } - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - if ((double)System.Math.Abs(num192) < (double)num188 * 0.2 && ((npc.velocity.X > 0f && num191 < 0f) || (npc.velocity.X < 0f && num191 > 0f))) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189 * 2f; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189 * 2f; - } - } - if ((double)System.Math.Abs(num191) < (double)num188 * 0.2 && ((npc.velocity.Y > 0f && num192 < 0f) || (npc.velocity.Y < 0f && num192 > 0f))) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189 * 2f; //changed from 2 - } - else - { - npc.velocity.X = npc.velocity.X - num189 * 2f; //changed from 2 - } - } - } - else - { - if (num196 > num197) - { - if (npc.velocity.X < num191) - { - npc.velocity.X = npc.velocity.X + num189 * 1.1f; //changed from 1.1 - } - else if (npc.velocity.X > num191) - { - npc.velocity.X = npc.velocity.X - num189 * 1.1f; //changed from 1.1 - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.Y > 0f) - { - npc.velocity.Y = npc.velocity.Y + num189; - } - else - { - npc.velocity.Y = npc.velocity.Y - num189; - } - } - } - else - { - if (npc.velocity.Y < num192) - { - npc.velocity.Y = npc.velocity.Y + num189 * 1.1f; - } - else if (npc.velocity.Y > num192) - { - npc.velocity.Y = npc.velocity.Y - num189 * 1.1f; - } - if ((double)(System.Math.Abs(npc.velocity.X) + System.Math.Abs(npc.velocity.Y)) < (double)num188 * 0.5) - { - if (npc.velocity.X > 0f) - { - npc.velocity.X = npc.velocity.X + num189; - } - else - { - npc.velocity.X = npc.velocity.X - num189; - } - } - } - } - } - } - - public override bool CanHitPlayer(Player target, ref int cooldownSlot) - { - cooldownSlot = 1; - return true; } - public override void HitEffect(int hitDirection, double damage) + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 0; + return npc.alpha == 0; + } + + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS5"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS6"), 1f); - npc.position.X = npc.position.X + (float)(npc.width / 2); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/DoGS6"), 1f); + npc.position.X = npc.position.X + (float)(npc.width / 2); npc.position.Y = npc.position.Y + (float)(npc.height / 2); npc.width = 50; npc.height = 50; @@ -436,7 +435,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } } - + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { if (damage > npc.lifeMax / 2) @@ -444,40 +443,33 @@ namespace CalamityMod.NPCs.TheDevourerofGods damage = 0; return false; } - double multiplier = 1.0; - damageTaken += (crit ? (damage * 2) : damage); - damage = (int)((double)damage * multiplier); - if (damageTaken >= 50000.0) - { - damage = (int)((double)damage * 0.2); - } - return true; + return true; } - public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("EidolicWail")) - { - damage /= 8; - } - } + public override void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + if (projectile.type == mod.ProjectileType("SulphuricAcidMist2") || projectile.type == mod.ProjectileType("EidolicWail")) + { + damage /= 4; + } + } - public override bool CheckActive() + public override bool CheckActive() { return false; } - + public override bool PreNPCLoot() { return false; } - + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) { npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); npc.damage = (int)(npc.damage * 0.8f); } - + public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(mod.BuffType("GodSlayerInferno"), 180, true); @@ -503,5 +495,5 @@ namespace CalamityMod.NPCs.TheDevourerofGods player.AddBuff(BuffID.Frostburn, 180, true); player.AddBuff(BuffID.Darkness, 180, true); } - } + } } \ No newline at end of file diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index 0a169a3ae3..0e462bd40f 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -32,10 +32,10 @@ namespace CalamityMod.NPCs.TownNPCs npc.aiStyle = 7; npc.damage = 10; npc.defense = 15; - npc.lifeMax = 250; + npc.lifeMax = 20000; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.5f; + npc.knockBackResist = 0.8f; animationType = NPCID.Guide; } diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index 586724a838..85afdfe81e 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.TownNPCs npc.aiStyle = 7; npc.damage = 10; npc.defense = 15; - npc.lifeMax = 250; + npc.lifeMax = 20000; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath6; npc.knockBackResist = 0.5f; @@ -194,21 +194,46 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add("If I was a magical horse in this reality I'd be out in space swirling cocktails as I watch space worms battle for my enjoyment."); } - dialogue.Add("Hey " + CalamityMod.donatorList[Main.rand.Next(CalamityMod.donatorList.Count)] + "! You're pretty good! ...wait, what's your name again?"); + int donorAmt = CalamityMod.donatorList.Count; + string firstDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; + + string secondDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; + while (secondDonor == firstDonor) + secondDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; + + string thirdDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; + while (thirdDonor == firstDonor || thirdDonor == secondDonor) + thirdDonor = CalamityMod.donatorList[Main.rand.Next(donorAmt)]; + + dialogue.Add("Hey " + firstDonor + ", " + secondDonor + ", and " + thirdDonor + "! You're all pretty good! ...wait, who are you?"); return dialogue[Main.rand.Next(dialogue.Count)]; } - public override void SetChatButtons(ref string button, ref string button2) + public string Death() + { + return "You have failed " + Main.player[Main.myPlayer].GetModPlayer().deathCount + + (Main.player[Main.myPlayer].GetModPlayer().deathCount == 1 ? " time." : " times."); + } + + public override void SetChatButtons(ref string button, ref string button2) { button = Language.GetTextValue("LegacyInterface.28"); - } + button2 = "Death Count"; + } public override void OnChatButtonClicked(bool firstButton, ref bool shop) { - if (firstButton) - shop = true; - } + if (firstButton) + { + shop = true; + } + else + { + shop = false; + Main.npcChatText = Death(); + } + } public override void SetupShop(Chest shop, ref int nextSlot) //charges 50% extra than the original item value { diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index be00a27853..d3598470bb 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -10,8 +10,6 @@ namespace CalamityMod.NPCs.TownNPCs [AutoloadHead] public class SEAHOE : ModNPC { - public bool tips = false; - public override void SetStaticDefaults() { DisplayName.SetDefault("Sea King"); @@ -33,17 +31,17 @@ namespace CalamityMod.NPCs.TownNPCs npc.height = 58; npc.aiStyle = 7; npc.damage = 10; - npc.defense = 15; - npc.lifeMax = 250; + npc.defense = 25; + npc.lifeMax = 7500; npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - npc.knockBackResist = 0.5f; + npc.knockBackResist = 0.65f; animationType = NPCID.Guide; } public override bool CanTownNPCSpawn(int numTownNPCs, int money) { - return CalamityWorld.downedCLAM; + return CalamityWorld.downedCLAM && CalamityWorld.downedDesertScourge; } public override string TownNPCName() @@ -95,6 +93,10 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add("Not sure how " + Main.npc[lilBitch].GivenName + " has not been roasted and digested by now, hanging around the sulphuric seas for so long. Peharps it got to his head."); } + int cirrus = NPC.FindFirstNPC(mod.NPCType("FAP")); + if (cirrus != -1) + dialogue.Add("Rumor has it " + Main.npc[cirrus].GivenName + " drinks to forget her troubled past."); + if (Main.bloodMoon) { dialogue.Add("I'm never keen on these nights. They're so violent."); @@ -229,12 +231,10 @@ namespace CalamityMod.NPCs.TownNPCs if (firstButton) { shop = true; - tips = false; } else { shop = false; - tips = true; Main.npcChatText = Lore(); Player player = Main.player[Main.myPlayer]; player.AddBuff(mod.BuffType("AmidiasBlessing"), 36000); diff --git a/NPCs/Yharon/DetonatingFlare.cs b/NPCs/Yharon/DetonatingFlare.cs index bc5fbd1bfb..ae37d2ec17 100644 --- a/NPCs/Yharon/DetonatingFlare.cs +++ b/NPCs/Yharon/DetonatingFlare.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Yharon npc.width = 50; //324 npc.height = 50; //216 npc.defense = 150; - npc.lifeMax = 15000; + npc.lifeMax = 10000; npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Yharon/DetonatingFlare2.cs b/NPCs/Yharon/DetonatingFlare2.cs index 444fa1f074..13abea381e 100644 --- a/NPCs/Yharon/DetonatingFlare2.cs +++ b/NPCs/Yharon/DetonatingFlare2.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.Yharon npc.width = 50; //324 npc.height = 50; //216 npc.defense = 150; - npc.lifeMax = 20000; + npc.lifeMax = 13000; npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; diff --git a/NPCs/Yharon/DetonatingFlare3.cs b/NPCs/Yharon/DetonatingFlare3.cs deleted file mode 100644 index 34ca14cc95..0000000000 --- a/NPCs/Yharon/DetonatingFlare3.cs +++ /dev/null @@ -1,239 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using CalamityMod.Projectiles; - -namespace CalamityMod.NPCs.Yharon -{ - public class DetonatingFlare3 : ModNPC - { - float num = 10f; - float num2 = 0.25f; - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Angery Flame"); - Main.npcFrameCount[npc.type] = 5; - } - - public override void SetDefaults() - { - npc.aiStyle = -1; - aiType = -1; - npc.damage = 0; - npc.width = 50; //324 - npc.height = 50; //216 - npc.defense = 0; - npc.lifeMax = 100; - npc.knockBackResist = 0f; - npc.noGravity = true; - npc.noTileCollide = true; - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.HitSound = SoundID.NPCHit52; - npc.DeathSound = SoundID.NPCDeath55; - npc.alpha = 255; - } - - public override void AI() - { - if (!NPC.AnyNPCs(mod.NPCType("Yharon"))) - { - npc.active = false; - npc.netUpdate = true; - return; - } - npc.alpha -= 3; - if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead) - { - npc.TargetClosest(true); - } - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num4 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num5 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num4 = (float)((int)(num4 / 8f) * 8); - num5 = (float)((int)(num5 / 8f) * 8); - vector.X = (float)((int)(vector.X / 8f) * 8); - vector.Y = (float)((int)(vector.Y / 8f) * 8); - num4 -= vector.X; - num5 -= vector.Y; - float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); - float num7 = num6; - bool flag = false; - if (num6 > 600f) - { - flag = true; - } - if (num6 == 0f) - { - num4 = npc.velocity.X; - num5 = npc.velocity.Y; - } - else - { - num6 = num / num6; - num4 *= num6; - num5 *= num6; - } - if (num7 > 100f) - { - npc.ai[0] += 1f; - if (npc.ai[0] > 0f) - { - npc.velocity.Y = npc.velocity.Y + 0.023f; - } - else - { - npc.velocity.Y = npc.velocity.Y - 0.023f; - } - if (npc.ai[0] < -100f || npc.ai[0] > 100f) - { - npc.velocity.X = npc.velocity.X + 0.023f; - } - else - { - npc.velocity.X = npc.velocity.X - 0.023f; - } - if (npc.ai[0] > 200f) - { - npc.ai[0] = -200f; - } - } - if (Main.player[npc.target].dead) - { - num4 = (float)npc.direction * num / 2f; - num5 = -num / 2f; - } - if (npc.velocity.X < num4) - { - npc.velocity.X = npc.velocity.X + num2; - } - else if (npc.velocity.X > num4) - { - npc.velocity.X = npc.velocity.X - num2; - } - if (npc.velocity.Y < num5) - { - npc.velocity.Y = npc.velocity.Y + num2; - } - else if (npc.velocity.Y > num5) - { - npc.velocity.Y = npc.velocity.Y - num2; - } - npc.localAI[0] += 1f; - if (Main.netMode != 1 && npc.localAI[0] >= 30f) - { - npc.localAI[0] = 0f; - int damage = Main.expertMode ? 106 : 125; //600 - Vector2 vector173 = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * (float)(npc.width + 20) / 2f + npc.Center; - float speed = 0.01f; - Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); - float playerX = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vectorShoot.X; - float playerY = Main.player[npc.target].position.Y - vectorShoot.Y; - float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); - playerXY = speed / playerXY; - playerX *= playerXY; - playerY *= playerXY; - Projectile.NewProjectile((int)vector173.X, (int)vector173.Y, playerX, playerY, mod.ProjectileType("FlareDust2"), damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(vector.X, vector.Y, num4, num5, 467, damage, 0f, Main.myPlayer, 0f, 0f); - } - int num10 = (int)npc.position.X + npc.width / 2; - int num11 = (int)npc.position.Y + npc.height / 2; - num10 /= 16; - num11 /= 16; - if (!WorldGen.SolidTile(num10, num11)) - { - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.3f, 0f, 0.25f); - } - if (num4 > 0f) - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4); - } - if (num4 < 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2((double)num5, (double)num4) + 3.14f; - } - float num12 = 0.7f; - if (npc.collideX) - { - npc.netUpdate = true; - npc.velocity.X = npc.oldVelocity.X * -num12; - if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f) - { - npc.velocity.X = 2f; - } - if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f) - { - npc.velocity.X = -2f; - } - } - if (npc.collideY) - { - npc.netUpdate = true; - npc.velocity.Y = npc.oldVelocity.Y * -num12; - if (npc.velocity.Y > 0f && (double)npc.velocity.Y < 1.5) - { - npc.velocity.Y = 2f; - } - if (npc.velocity.Y < 0f && (double)npc.velocity.Y > -1.5) - { - npc.velocity.Y = -2f; - } - } - if (flag) - { - if ((npc.velocity.X > 0f && num4 > 0f) || (npc.velocity.X < 0f && num4 < 0f)) - { - if (Math.Abs(npc.velocity.X) < 12f) - { - npc.velocity.X = npc.velocity.X * 1.05f; - } - } - else - { - npc.velocity.X = npc.velocity.X * 0.9f; - } - } - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - { - npc.netUpdate = true; - } - } - - public override Color? GetAlpha(Color drawColor) - { - return new Color(255, Main.DiscoG, 53, 0); - } - - public override void FindFrame(int frameHeight) - { - npc.frameCounter += 0.15f; - npc.frameCounter %= Main.npcFrameCount[npc.type]; - int frame = (int)npc.frameCounter; - npc.frame.Y = frame * frameHeight; - } - - public override bool CheckActive() - { - return false; - } - - public override bool PreNPCLoot() - { - return false; - } - - public override void ScaleExpertStats(int numPlayers, float bossLifeScale) - { - npc.lifeMax = 100; - npc.damage = 0; - } - } -} \ No newline at end of file diff --git a/NPCs/Yharon/DetonatingFlare3.png b/NPCs/Yharon/DetonatingFlare3.png deleted file mode 100644 index 15996588e9..0000000000 Binary files a/NPCs/Yharon/DetonatingFlare3.png and /dev/null differ diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 8ef00e3942..5ca0bfdcfc 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -21,7 +21,9 @@ namespace CalamityMod.NPCs.Yharon private bool moveCloser = false; private bool phaseOneLoot = false; private bool dropLoot = false; + private bool useTornado = true; private int healCounter = 0; + private int secondPhasePhase = 1; public override void SetStaticDefaults() { @@ -45,6 +47,8 @@ namespace CalamityMod.NPCs.Yharon { npc.lifeMax = CalamityWorld.death ? 4000000 : 3700000; } + double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); npc.knockBackResist = 0f; npc.aiStyle = -1; //new aiType = -1; //new @@ -55,11 +59,11 @@ namespace CalamityMod.NPCs.Yharon for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; - npc.buffImmune[BuffID.Ichor] = false; - npc.buffImmune[BuffID.CursedInferno] = false; - npc.buffImmune[mod.BuffType("DemonFlames")] = false; - npc.buffImmune[mod.BuffType("Shred")] = false; } + npc.buffImmune[BuffID.Ichor] = false; + npc.buffImmune[BuffID.CursedInferno] = false; + npc.buffImmune[mod.BuffType("DemonFlames")] = false; + npc.buffImmune[mod.BuffType("Shred")] = false; npc.noGravity = true; npc.noTileCollide = true; npc.netAlways = true; @@ -68,7 +72,7 @@ namespace CalamityMod.NPCs.Yharon music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARON"); else music = MusicID.Boss1; - if (CalamityWorld.downedProvidence && CalamityWorld.downedDoG && CalamityWorld.downedBuffedMothron || CalamityWorld.bossRushActive) + if (CalamityWorld.downedBuffedMothron || CalamityWorld.bossRushActive) { if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/YHARONREBIRTH"); @@ -94,49 +98,6 @@ namespace CalamityMod.NPCs.Yharon } if (npc.localAI[2] == 1f) { - if ((!CalamityWorld.downedProvidence || !CalamityWorld.downedDoG) && !CalamityWorld.bossRushActive) - { - phaseOneLoot = true; - npc.DeathSound = null; - npc.dontTakeDamage = true; - npc.chaseable = false; - npc.velocity.Y = npc.velocity.Y - 0.4f; - if (npc.alpha < 255) - { - npc.alpha += 5; - if (npc.alpha > 255) - { - npc.alpha = 255; - } - } - if (npc.timeLeft > 55) - { - npc.timeLeft = 55; - } - if (npc.timeLeft < 5) - { - string key = "Mods.CalamityMod.DargonBossText3"; - Color messageColor = Color.Orange; - if (Main.netMode == 0) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == 2) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - npc.localAI[2] = 2f; - npc.boss = false; - npc.life = 0; - if (dropLoot) - { - npc.NPCLoot(); - } - npc.active = false; - npc.netUpdate = true; - } - return; - } if (!CalamityWorld.downedBuffedMothron && !CalamityWorld.bossRushActive) { phaseOneLoot = true; @@ -246,7 +207,7 @@ namespace CalamityMod.NPCs.Yharon int aiChangeRate = expertMode ? 36 : 38; float npcVelocity = expertMode ? 0.7f : 0.69f; float scaleFactor = expertMode ? 11f : 10.8f; - if (phase4Change || npc.GetGlobalNPC(mod).enraged) + if (phase4Change || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { npcVelocity = 0.95f; scaleFactor = 14f; @@ -272,7 +233,7 @@ namespace CalamityMod.NPCs.Yharon int chargeTime2 = expertMode ? 34 : 36; float chargeSpeed = expertMode ? 22f : 20.5f; //17 and 16 float chargeSpeed2 = expertMode ? 37f : 34f; - if (phase4Change || npc.GetGlobalNPC(mod).enraged) //phase 4 + if (phase4Change || npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) //phase 4 { chargeTime = 28; chargeSpeed = 31f; //27 @@ -1868,14 +1829,39 @@ namespace CalamityMod.NPCs.Yharon { bool revenge = (CalamityWorld.revenge || CalamityWorld.bossRushActive); bool expertMode = Main.expertMode; - bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.66; - bool phase3 = (double)npc.life <= (double)npc.lifeMax * 0.33; - bool tantrum = (double)npc.life <= (double)npc.lifeMax * 0.04; - npc.defense = 100; - npc.alpha -= 25; - if (npc.alpha < 0) + bool phase2 = (double)npc.life <= (double)npc.lifeMax * 0.75; + bool phase3 = (double)npc.life <= (double)npc.lifeMax * 0.5; + bool phase4 = (double)npc.life <= (double)npc.lifeMax * 0.05; + if (CalamityWorld.death) { - npc.alpha = 0; + phase2 = (double)npc.life <= (double)npc.lifeMax * 0.95; + phase3 = (double)npc.life <= (double)npc.lifeMax * 0.7; + phase4 = (double)npc.life <= (double)npc.lifeMax * 0.15; + } + else if (revenge) + { + phase2 = (double)npc.life <= (double)npc.lifeMax * 0.85; + phase3 = (double)npc.life <= (double)npc.lifeMax * 0.6; + phase4 = (double)npc.life <= (double)npc.lifeMax * 0.1; + } + float teleportLocation = 0f; + int teleChoice = Main.rand.Next(2); + if (teleChoice == 0) + { + teleportLocation = revenge ? 600f : 700f; + } + else + { + teleportLocation = revenge ? -600f : -700f; + } + npc.defense = 100; + if (npc.ai[0] != 8f) + { + npc.alpha -= 25; + if (npc.alpha < 0) + { + npc.alpha = 0; + } } if (!moveCloser) { @@ -1885,10 +1871,6 @@ namespace CalamityMod.NPCs.Yharon else music = MusicID.LunarBoss; moveCloser = true; - if ((CalamityWorld.death || CalamityWorld.bossRushActive) && Main.netMode != 1) - { - NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, mod.NPCType("DetonatingFlare3"), 0, 0f, 0f, 0f, 0f, 255); - } string key = "Mods.CalamityMod.FlameText"; Color messageColor = Color.Orange; if (Main.netMode == 0) @@ -1902,20 +1884,16 @@ namespace CalamityMod.NPCs.Yharon } if (npc.localAI[3] < 900f) { + phase2 = phase3 = phase4 = false; npc.localAI[3] += 1f; - int heal = 5; //180 heals 50% and 30% + int heal = 5; //900 / 5 = 180 healCounter += 1; if (healCounter >= heal) { healCounter = 0; if (Main.netMode != 1) { - int fractionHealed = revenge ? 240 : 300; //100000 / 240 * 180 = 75000 healed = 75% heal - if (CalamityWorld.death || CalamityWorld.bossRushActive) - { - fractionHealed = 200; //100000 / 200 * 180 = 90000 healed = 90% heal - } - int healAmt = npc.lifeMax / fractionHealed; + int healAmt = npc.lifeMax / 200; if (healAmt > npc.lifeMax - npc.life) { healAmt = npc.lifeMax - npc.life; @@ -1931,8 +1909,8 @@ namespace CalamityMod.NPCs.Yharon } else { - npc.dontTakeDamage = false; - npc.chaseable = true; + npc.dontTakeDamage = npc.ai[0] == 9f; + npc.chaseable = npc.ai[0] < 8f; } NPCUtils.TargetClosestBetsy(npc, false, null); NPCAimedTarget targetData = npc.GetTargetData(true); @@ -1948,6 +1926,10 @@ namespace CalamityMod.NPCs.Yharon else { npc.damage = expertMode ? 528 : 330; + if (phase4) + { + npc.damage = (int)((double)npc.damage * 1.25); + } protectionBoost = false; if (npc.timeLeft < 3600) { @@ -1956,23 +1938,23 @@ namespace CalamityMod.NPCs.Yharon } int num = -1; float num2 = 1f; - int num4 = expertMode ? 106 : 125; //600 - float num5 = 10f; - float num6 = revenge ? 0.6f : 0.55f; //0.45 - float scaleFactor = revenge ? 10f : 9f; //7.5 - float num7 = 30f; - float num8 = 30f; - float scaleFactor2 = revenge ? 26f : 24.5f; //23 - float num9 = 600f; - float num10 = 12f; + int num4 = expertMode ? 106 : 125; + if (phase4) + { + num4 = (int)((double)num4 * 1.25); + } + float num6 = revenge ? 0.6f : 0.55f; + float scaleFactor = revenge ? 10f : 9f; + float chargeTime = 34f; + float chargeTime2 = 30f; + float chargeSpeed = revenge ? 26f : 25f; + float chargeSpeed2 = revenge ? 40f : 38f; float num11 = 40f; - float num12 = (CalamityWorld.death && !CalamityWorld.bossRushActive) ? 60f : 80f; + float num12 = 80f; float num13 = num11 + num12; - float num14 = 1500f; float num15 = 60f; - float scaleFactor3 = 13f; - float amount = 0.0333333351f; - float scaleFactor4 = revenge ? 16f : 14.5f; //12 + float scaleFactor3 = 14f; + float scaleFactor4 = revenge ? 16f : 15f; //12 int num16 = 10; int num17 = 6 * num16; float num18 = 60f; @@ -1980,17 +1962,24 @@ namespace CalamityMod.NPCs.Yharon float num20 = 60f; float num21 = 1f; float num22 = 6.28318548f * (num21 / num20); - float num23 = 0.1f; float scaleFactor5 = revenge ? 38f : 36.5f; //32 - if (npc.GetGlobalNPC(mod).enraged) + if (CalamityWorld.death) + { + scaleFactor = 10.5f; + chargeSpeed = 27f; + chargeSpeed2 = 41f; + scaleFactor4 = 16.5f; + scaleFactor5 = 39f; + } + if (npc.GetGlobalNPC(mod).enraged || (Config.BossRushXerocCurse && CalamityWorld.bossRushActive)) { num6 = 0.65f; scaleFactor = 11f; - scaleFactor2 = 28f; + chargeSpeed = 32f; + chargeSpeed2 = 45f; scaleFactor4 = 18f; scaleFactor5 = 40f; } - float num24 = 90f; float num25 = 20f; float arg_F9_0 = npc.ai[0]; float num26; @@ -2000,7 +1989,7 @@ namespace CalamityMod.NPCs.Yharon int expr_115_cp_1 = 1; num26 = expr_115_cp_0[expr_115_cp_1] + 1f; expr_115_cp_0[expr_115_cp_1] = num26; - if (num26 >= num5) + if (num26 >= 10f) { npc.ai[1] = 0f; npc.ai[0] = 1f; @@ -2023,10 +2012,26 @@ namespace CalamityMod.NPCs.Yharon int expr_225_cp_1 = 1; num26 = expr_225_cp_0[expr_225_cp_1] + 1f; expr_225_cp_0[expr_225_cp_1] = num26; - if (num26 >= num7) + if (num26 >= 30f) { int num28 = 1; - if (phase3) + if (phase4) + { + switch ((int)npc.ai[3]) + { + case 0: + num28 = 8; //teleport + break; + case 1: + case 2: + num28 = 7; //fast charge + break; + case 3: + num28 = 5; //fire circle + tornado (only once) + fireballs + break; + } + } + else if (phase3) { switch ((int)npc.ai[3]) { @@ -2034,29 +2039,49 @@ namespace CalamityMod.NPCs.Yharon num28 = 6; //tornado break; case 1: - num28 = 2; //charge + num28 = 7; //fast charge break; case 2: - num28 = 5; //fire circle + num28 = 8; //teleport break; case 3: - num28 = 4; //splitting fireballs + num28 = 7; //fast charge break; case 4: - num28 = 3; //homing fireballs - break; - case 5: - num28 = 6; //tornado - break; - case 6: - case 7: - num28 = 2; //double charge - break; - case 8: num28 = 5; //fire circle break; + case 5: + num28 = 4; //fireballs + break; + case 6: + num28 = 7; //fast charge + break; + case 7: + num28 = 8; //teleport + break; + case 8: + num28 = 7; //fast charge + break; case 9: - num28 = 4; //splitting fireballs + num28 = 3; //fireballs + break; + case 10: + num28 = 6; //tornado + break; + case 11: + num28 = 7; //fast charge + break; + case 12: + num28 = 8; //teleport + break; + case 13: + num28 = 7; //fast charge + break; + case 14: + num28 = 5; //fire circle + break; + case 15: + num28 = 4; //fireballs break; } } @@ -2068,6 +2093,8 @@ namespace CalamityMod.NPCs.Yharon num28 = 6; //tornado break; case 1: + num28 = 7; //fast charge + break; case 2: num28 = 2; //charge break; @@ -2075,17 +2102,24 @@ namespace CalamityMod.NPCs.Yharon num28 = 5; //fire circle break; case 4: - num28 = 3; //homing fireballs + num28 = 4; //fireballs break; case 5: + num28 = 7; //fast charge + break; case 6: - num28 = 4; //double splitting fireballs + num28 = 2; //charge break; case 7: + num28 = 3; //fireballs + break; case 8: - num28 = 2; //double charge + num28 = 7; //fast charge break; case 9: + num28 = 2; //charge + break; + case 10: num28 = 5; //fire circle break; } @@ -2099,36 +2133,77 @@ namespace CalamityMod.NPCs.Yharon break; case 1: case 2: - num28 = 2; //double charge + num28 = 2; //charge break; case 3: - num28 = 3; //homing fireballs + num28 = 3; //fireballs break; case 4: - num28 = 4; //splitting fireballs - break; case 5: + num28 = 2; //charge + break; case 6: - num28 = 2; //double charge + num28 = 4; //fireballs break; case 7: + case 8: + num28 = 2; //charge + break; + case 9: num28 = 5; //fire circle break; } } npc.ai[0] = (float)num28; - if (tantrum) - { - npc.ai[0] = 2f; - } npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] += 1f; - npc.netUpdate = true; - float aiLimit = 8f; - if (phase2) + switch (secondPhasePhase) { - aiLimit = 10f; + case 1: + if (phase2) + { + secondPhasePhase = 2; + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + break; + case 2: + if (phase3) + { + secondPhasePhase = 3; + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + break; + case 3: + if (phase4) + { + secondPhasePhase = 4; + npc.ai[0] = 9f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + break; + } + npc.netUpdate = true; + float aiLimit = 10f; + if (phase4) + { + aiLimit = 4f; + } + else if (phase3) + { + aiLimit = 16f; + } + else if (phase2) + { + aiLimit = 11f; } if (npc.ai[3] >= aiLimit) { @@ -2145,10 +2220,10 @@ namespace CalamityMod.NPCs.Yharon { npc.rotation += 3.14159274f; } - npc.velocity = vector * scaleFactor2; + npc.velocity = vector * chargeSpeed; break; } - case 3: //homing fireballs + case 3: //fireballs { Vector2 vector2 = new Vector2((float)((targetData.Center.X > npc.Center.X) ? 1 : -1), 0f); npc.spriteDirection = ((vector2.X > 0f) ? 1 : -1); @@ -2167,36 +2242,60 @@ namespace CalamityMod.NPCs.Yharon npc.velocity = vector3 * scaleFactor5; break; } + case 7: //fast charge + { + Vector2 vector = npc.DirectionTo(targetData.Center); + npc.spriteDirection = ((vector.X > 0f) ? 1 : -1); + npc.rotation = vector.ToRotation(); + if (npc.spriteDirection == -1) + { + npc.rotation += 3.14159274f; + } + npc.velocity = vector * chargeSpeed2; + break; + } } } } else if (npc.ai[0] == 2f) { - if (npc.ai[1] == 0f) + if (npc.ai[1] == 1f) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); } + int num1473 = 7; + for (int num1474 = 0; num1474 < num1473; num1474++) + { + Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1473), default(Vector2)) + npc.Center; + Vector2 value18 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num1475].noGravity = true; + Main.dust[num1475].noLight = true; + Main.dust[num1475].velocity /= 4f; + Main.dust[num1475].velocity -= npc.velocity; + } float[] expr_498_cp_0 = npc.ai; int expr_498_cp_1 = 1; num26 = expr_498_cp_0[expr_498_cp_1] + 1f; expr_498_cp_0[expr_498_cp_1] = num26; - if (num26 >= num8) + if (num26 >= chargeTime) { npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; } } - else if (npc.ai[0] == 3f) //homing fireball spit + else if (npc.ai[0] == 3f) //fireball spit { npc.ai[1] += 1f; int num29 = (npc.Center.X < targetData.Center.X) ? 1 : -1; npc.ai[2] = (float)num29; if (npc.ai[1] < num11) { - Vector2 vector4 = targetData.Center + new Vector2((float)num29 * -num9, -250f); - Vector2 value = npc.DirectionTo(vector4) * num10; - if (npc.Distance(vector4) < num10) + Vector2 vector4 = targetData.Center + new Vector2((float)num29 * -600f, -250f); + Vector2 value = npc.DirectionTo(vector4) * 12f; + if (npc.Distance(vector4) < 12f) { npc.Center = vector4; } @@ -2218,12 +2317,20 @@ namespace CalamityMod.NPCs.Yharon } if (npc.ai[1] >= num11) { - if (npc.ai[1] % 10 == 0 && Main.netMode != 1) + if (npc.ai[1] % 8 == 0 && Main.netMode != 1) { float num33 = 30f; - Vector2 position = npc.Center + new Vector2((110f /* 110f */ + num33) * (float)npc.direction, -20f /* 20f */).RotatedBy((double)npc.rotation, + Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, default(Vector2)); - Projectile.NewProjectile(position, npc.velocity, mod.ProjectileType("YharonFireballHoming"), num4, 0f, Main.myPlayer, 0f, 0f); + float speed = 0.01f; + Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + float playerX = targetData.Center.X - vectorShoot.X; + float playerY = targetData.Center.Y - vectorShoot.Y; + float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); + playerXY = speed / playerXY; + playerX *= playerXY; + playerY *= playerXY; + Projectile.NewProjectile(position.X, position.Y, playerX, playerY, mod.ProjectileType("FlareDust2"), num4, 0f, Main.myPlayer, 1f, 0f); } num2 = 1.5f; if (Math.Abs(targetData.Center.X - npc.Center.X) > 550f && Math.Abs(npc.velocity.X) < 20f) @@ -2238,15 +2345,15 @@ namespace CalamityMod.NPCs.Yharon npc.ai[2] = 0f; } } - else if (npc.ai[0] == 4f) //splitting fireball spit + else if (npc.ai[0] == 4f) //fireball spit { int num31 = (npc.Center.X < targetData.Center.X) ? 1 : -1; npc.ai[2] = (float)num31; if (npc.ai[1] < num15) { - Vector2 vector5 = targetData.Center + new Vector2((float)num31 * -num14, -350f); + Vector2 vector5 = targetData.Center + new Vector2((float)num31 * -1500f, -350f); Vector2 value2 = npc.DirectionTo(vector5) * scaleFactor3; - npc.velocity = Vector2.Lerp(npc.velocity, value2, amount); + npc.velocity = Vector2.Lerp(npc.velocity, value2, 0.0333333351f); int num32 = (npc.Center.X < targetData.Center.X) ? 1 : -1; npc.direction = (npc.spriteDirection = num32); if (Vector2.Distance(vector5, npc.Center) < 16f) @@ -2277,12 +2384,12 @@ namespace CalamityMod.NPCs.Yharon num2 = 1.5f; } float num33 = 30f; - Vector2 position = npc.Center + new Vector2((110f /* 110f */ + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, + Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, default(Vector2)); int num34 = (int)(npc.ai[1] - num15 + 1f); if (num34 <= num17 && num34 % num16 == 0 && Main.netMode != 1) { - Projectile.NewProjectile(position, npc.velocity, mod.ProjectileType("YharonFireball"), num4, 0f, Main.myPlayer, 0f, 0f); //change + Projectile.NewProjectile(position, npc.velocity, mod.ProjectileType("YharonFireball"), num4, 0f, Main.myPlayer, 0f, 0f); } } if (npc.ai[1] > num19 - num18) @@ -2297,10 +2404,10 @@ namespace CalamityMod.NPCs.Yharon npc.ai[2] = 0f; } } - else if (npc.ai[0] == 5f) + else if (npc.ai[0] == 5f) //spin 2 win { npc.velocity = npc.velocity.RotatedBy((double)(-(double)num22 * (float)npc.direction), default(Vector2)); - npc.position.Y = npc.position.Y - num23; + npc.position.Y = npc.position.Y - 0.1f; npc.position += npc.DirectionTo(targetData.Center) * 10f; npc.rotation -= num22 * (float)npc.direction; num2 *= 0.7f; @@ -2312,13 +2419,32 @@ namespace CalamityMod.NPCs.Yharon int expr_B0F_cp_1 = 1; num26 = expr_B0F_cp_0[expr_B0F_cp_1] + 1f; expr_B0F_cp_0[expr_B0F_cp_1] = num26; - if (npc.ai[1] % 12 == 0 && Main.netMode != 1) + if (Main.netMode != 1) { - float num33 = 30f; - Vector2 position = npc.Center + new Vector2((110f /* 110f */ + num33) * (float)npc.direction, -20f /* 20f */).RotatedBy((double)npc.rotation, - default(Vector2)); - int projectileType = (((npc.ai[1] / 2) % 12 == 0) ? mod.ProjectileType("YharonFireball") : mod.ProjectileType("YharonFireballHoming")); - Projectile.NewProjectile(position, npc.velocity, projectileType, num4, 0f, Main.myPlayer, 0f, 0f); + if (npc.ai[1] % 12 == 0) + { + float num33 = 30f; + Vector2 position = npc.Center + new Vector2((110f + num33) * (float)npc.direction, -20f).RotatedBy((double)npc.rotation, + default(Vector2)); + Projectile.NewProjectile(position, npc.velocity, mod.ProjectileType("YharonFireball"), num4, 0f, Main.myPlayer, 0f, 0f); + if (phase4) + { + float speed = 0.01f; + Vector2 vectorShoot = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f + 30f); + float playerX = targetData.Center.X - vectorShoot.X; + float playerY = targetData.Center.Y - vectorShoot.Y; + float playerXY = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); + playerXY = speed / playerXY; + playerX *= playerXY; + playerY *= playerXY; + Projectile.NewProjectile(position.X, position.Y, playerX, playerY, mod.ProjectileType("FlareDust2"), num4, 0f, Main.myPlayer, 0f, 0f); + } + } + if (npc.ai[1] == 45f && phase4 && useTornado) + { + useTornado = false; + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("BigFlare2"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); + } } if (num26 >= num20) { @@ -2328,7 +2454,7 @@ namespace CalamityMod.NPCs.Yharon npc.velocity /= 2f; } } - else if (npc.ai[0] == 6f) //birb spawn + else if (npc.ai[0] == 6f) //flare spawn { if (npc.ai[1] == 0f) { @@ -2368,7 +2494,8 @@ namespace CalamityMod.NPCs.Yharon } num2 *= 0.85f; bool flag3 = npc.ai[1] == 20f || npc.ai[1] == 45f || npc.ai[1] == 70f; - if (NPC.CountNPCS(mod.NPCType("Bumblefuck3")) > 2) + int flareCount = NPC.CountNPCS(mod.NPCType("DetonatingFlare")) + NPC.CountNPCS(mod.NPCType("DetonatingFlare2")); + if (flareCount > 5) { flag3 = false; } @@ -2378,13 +2505,15 @@ namespace CalamityMod.NPCs.Yharon if (Vector2.Distance(vector7, targetData.Center) > 100f) { Point point2 = vector7.ToPoint(); - NPC.NewNPC(point2.X, point2.Y, mod.NPCType("Bumblefuck3"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC(point2.X, point2.Y, mod.NPCType("DetonatingFlare"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC(point2.X, point2.Y, mod.NPCType("DetonatingFlare2"), npc.whoAmI, 0f, 0f, 0f, 0f, 255); } - NPC.NewNPC((int)npc.Center.X + (Main.rand.Next(2) == 0 ? 100 : -100), (int)npc.Center.Y - 100, mod.NPCType("Bumblefuck3"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X + (Main.rand.Next(2) == 0 ? 100 : -100), (int)npc.Center.Y - 100, mod.NPCType("DetonatingFlare"), 0, 0f, 0f, 0f, 0f, 255); + NPC.NewNPC((int)npc.Center.X + (Main.rand.Next(2) == 0 ? 100 : -100), (int)npc.Center.Y - 100, mod.NPCType("DetonatingFlare2"), 0, 0f, 0f, 0f, 0f, 255); } npc.ai[1] += 1f; } - if (npc.ai[1] >= num24) + if (npc.ai[1] >= 90f) { Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("BigFlare2"), 0, 0f, Main.myPlayer, 1f, (float)(npc.target + 1)); Boom(600, num4); @@ -2393,6 +2522,119 @@ namespace CalamityMod.NPCs.Yharon npc.ai[2] = 0f; } } + else if (npc.ai[0] == 7f) //speedee chargee + { + if (npc.ai[1] == 1f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + int num1473 = 7; + for (int num1474 = 0; num1474 < num1473; num1474++) + { + Vector2 vector171 = Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f; + vector171 = vector171.RotatedBy((double)(num1474 - (num1473 / 2 - 1)) * 3.1415926535897931 / (double)((float)num1473), default(Vector2)) + npc.Center; + Vector2 value18 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num1475 = Dust.NewDust(vector171 + value18, 0, 0, 244, value18.X * 2f, value18.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num1475].noGravity = true; + Main.dust[num1475].noLight = true; + Main.dust[num1475].velocity /= 4f; + Main.dust[num1475].velocity -= npc.velocity; + } + float[] expr_498_cp_0 = npc.ai; + int expr_498_cp_1 = 1; + num26 = expr_498_cp_0[expr_498_cp_1] + 1f; + expr_498_cp_0[expr_498_cp_1] = num26; + if (num26 >= chargeTime2) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + } + } + else if (npc.ai[0] == 8f) //teleport + { + Vector2 npcCenter = npc.Center; + if (npc.alpha < 255) + { + npc.alpha += 17; + if (npc.alpha > 255) + { + npc.alpha = 255; + } + } + npc.velocity *= 0.98f; + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); + if (npc.ai[2] == 15f) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoarShort"), (int)npc.position.X, (int)npc.position.Y); + } + if (Main.netMode != 1 && npc.ai[2] == 15f) + { + if (npc.ai[1] == 0f) + { + npc.ai[1] = (float)(300 * Math.Sign((npcCenter - targetData.Center).X)); + } + Vector2 center = targetData.Center + new Vector2(-npc.ai[1], teleportLocation); //teleport distance + npcCenter = (npc.Center = center); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 25f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; + } + } + else if (npc.ai[0] == 9f) //enter next phase + { + npc.chaseable = false; + npc.velocity *= 0.95f; + Vector2 vector = npc.DirectionTo(targetData.Center); + npc.spriteDirection = ((vector.X > 0f) ? 1 : -1); + npc.rotation = vector.ToRotation(); + if (npc.spriteDirection == -1) + { + npc.rotation += 3.14159274f; + } + if (npc.ai[2] == 120f) + { + if (phase4) + { + int proj; + for (int x = 0; x < 1000; x = proj + 1) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active) + { + if (projectile.type == mod.ProjectileType("Infernado2")) + { + if (projectile.ai[0] < 10f) + { + projectile.ai[0] = 10f; + projectile.netUpdate = true; + } + if (projectile.timeLeft > 5) + projectile.timeLeft = (int)(5f * projectile.ai[1]); + } + else if (projectile.type == mod.ProjectileType("BigFlare2")) + projectile.active = false; + } + proj = x; + } + } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); + } + npc.ai[2] += 1f; + if (npc.ai[2] >= 180f) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + } npc.localAI[0] += num2; if (npc.localAI[0] >= 36f) { @@ -2416,6 +2658,9 @@ namespace CalamityMod.NPCs.Yharon { case 2: case 5: + case 7: + case 8: + case 9: num43 = 0f; break; case 3: @@ -2481,7 +2726,7 @@ namespace CalamityMod.NPCs.Yharon int num161 = num159; if (npc.localAI[2] == 1f && !phaseOneLoot) { - bool drawAfterImage2 = (npc.ai[0] == 2f || npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 5f) && Lighting.NotRetro; + bool drawAfterImage2 = (npc.ai[0] == 2f || npc.ai[0] == 3f || npc.ai[0] == 4f || npc.ai[0] == 5f || npc.ai[0] == 7f) && Lighting.NotRetro; SpriteEffects spriteEffects2 = spriteEffects ^ SpriteEffects.FlipHorizontally; if (npc.localAI[3] < 900f) { @@ -2569,6 +2814,17 @@ namespace CalamityMod.NPCs.Yharon { if (npc.localAI[2] == 1f) { + if (Main.rand.Next(40) == 0) + { + if (Main.expertMode) + npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("VoidVortex"), 1, true); + else + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("VoidVortex")); + } + if (Main.rand.Next(10) == 0) + { + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ForgottenDragonEgg")); + } npc.DropItemInstanced(npc.position, npc.Size, mod.ItemType("HellcasterFragment"), Main.rand.Next(15, 23), true); } if (Main.rand.Next(7) == 0) @@ -2673,7 +2929,7 @@ namespace CalamityMod.NPCs.Yharon public override void FindFrame(int frameHeight) { if ((npc.localAI[2] != 1f && (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f || npc.ai[0] == 21f)) || - (npc.localAI[2] == 1f && (npc.ai[0] == 5f || npc.ai[0] < 3f))) //idle + (npc.localAI[2] == 1f && (npc.ai[0] == 5f || npc.ai[0] < 2f))) //idle { int num84 = 4; //5 if (npc.localAI[2] != 1f && (npc.ai[0] == 6f || npc.ai[0] == 13f || npc.ai[0] == 21f)) //Phase ai switch @@ -2691,13 +2947,13 @@ namespace CalamityMod.NPCs.Yharon npc.frame.Y = 0; } } - if ((npc.localAI[2] != 1f && (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || - npc.ai[0] == 14f || npc.ai[0] == 18f || npc.ai[0] == 22f)) || (npc.localAI[2] == 1f && (npc.ai[0] == 6f))) //Charging or birb spawn + if ((npc.localAI[2] != 1f && (npc.ai[0] == 1f || npc.ai[0] == 5f || npc.ai[0] == 7f || npc.ai[0] == 11f || npc.ai[0] == 14f || npc.ai[0] == 18f || npc.ai[0] == 22f)) || + (npc.localAI[2] == 1f && (npc.ai[0] == 6f || npc.ai[0] == 2f || npc.ai[0] == 7f))) //Charging or birb spawn { npc.frame.Y = frameHeight * 5; //6 } if ((npc.localAI[2] != 1f && (npc.ai[0] == 2f || npc.ai[0] == 8f || npc.ai[0] == 12f || npc.ai[0] == 15f || npc.ai[0] == 19f || npc.ai[0] == 23f)) || - (npc.localAI[2] == 1f && (npc.ai[0] == 4f || npc.ai[0] == 3f))) //Fireball spit or circle or flamethrower + (npc.localAI[2] == 1f && (npc.ai[0] == 4f || npc.ai[0] == 3f || npc.ai[0] == 8f))) //Fireball spit, teleport, circle, flamethrower { npc.frame.Y = frameHeight * 5; //6 } @@ -2726,7 +2982,8 @@ namespace CalamityMod.NPCs.Yharon } } } - if (npc.localAI[2] != 1f && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f || npc.ai[0] == 25f)) //Enter new phase + if ((npc.localAI[2] != 1f && (npc.ai[0] == 4f || npc.ai[0] == 10f || npc.ai[0] == 17f || npc.ai[0] == 25f)) || + (npc.localAI[2] == 1f && npc.ai[0] == 9f)) //Enter new phase { int num86 = 180; if (npc.ai[2] < (float)(num86 - 60) || npc.ai[2] > (float)(num86 - 20)) diff --git a/Projectiles/Amidias/AmidiasWhirlpool.cs b/Projectiles/Amidias/AmidiasWhirlpool.cs index c4fea0f760..9ede171555 100644 --- a/Projectiles/Amidias/AmidiasWhirlpool.cs +++ b/Projectiles/Amidias/AmidiasWhirlpool.cs @@ -13,12 +13,14 @@ namespace CalamityMod.Projectiles.Amidias public override void SetStaticDefaults() { DisplayName.SetDefault("Whirlpool"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 5; + ProjectileID.Sets.TrailingMode[projectile.type] = 2; } public override void SetDefaults() { - projectile.width = 32; - projectile.height = 32; + projectile.width = 58; + projectile.height = 58; projectile.friendly = true; projectile.penetrate = 3; projectile.extraUpdates = 1; @@ -136,19 +138,9 @@ namespace CalamityMod.Projectiles.Amidias if (projectile.ai[0] >= 120f) { projectile.Kill(); - return; } } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } - public override Color? GetAlpha(Color lightColor) { return new Color(30, 255, 253); diff --git a/Projectiles/Amidias/UrchinBall.cs b/Projectiles/Amidias/UrchinBall.cs index 4135dc2bd1..97e14bf016 100644 --- a/Projectiles/Amidias/UrchinBall.cs +++ b/Projectiles/Amidias/UrchinBall.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Amidias projectile.alpha = 255; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 3; + projectile.GetGlobalProjectile(mod).trueMelee = true; } public override void AI() diff --git a/Projectiles/Astral/AstralCannonProjectile.cs b/Projectiles/Astral/AstralCannonProjectile.cs index 377b1966a8..edb612e368 100644 --- a/Projectiles/Astral/AstralCannonProjectile.cs +++ b/Projectiles/Astral/AstralCannonProjectile.cs @@ -8,30 +8,30 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Astral { - public class AstralCannonProjectile : ModProjectile - { - public override void SetStaticDefaults() + public class AstralCannonProjectile : ModProjectile + { + public override void SetStaticDefaults() { DisplayName.SetDefault("Astral Crystal"); - Main.projFrames[projectile.type] = 4; - } - - public override void SetDefaults() - { - projectile.width = 50; - projectile.height = 40; - projectile.friendly = true; - projectile.ignoreWater = true; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.alpha = 255; - projectile.penetrate = 1; - projectile.timeLeft = 300; - } + Main.projFrames[projectile.type] = 4; + } - public override void AI() - { - if(projectile.alpha > 0) + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 40; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + if (projectile.alpha > 0) { projectile.alpha -= 5; } @@ -40,67 +40,67 @@ namespace CalamityMod.Projectiles.Astral projectile.alpha = 0; projectile.tileCollide = true; } - projectile.frameCounter++; - if (projectile.frameCounter > 4) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) - { - projectile.spriteDirection = -projectile.direction; - } - if (projectile.velocity.X < 0f) - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - else - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); - } - Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); - projectile.velocity *= 1.075f; - } + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + if ((double)Math.Abs(projectile.velocity.X) > 0.2) + { + projectile.spriteDirection = -projectile.direction; + } + if (projectile.velocity.X < 0f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + else + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + } + Lighting.AddLight(projectile.Center, 0.3f, 0.5f, 0.1f); + projectile.velocity *= 1.075f; + } - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; - int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; - int y6 = num214 * projectile.frame; - Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); - } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GodSlayerInferno"), 300); + } - public override void Kill(int timeLeft) - { - Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 188); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + public override void Kill(int timeLeft) + { + Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 103, 1f, 0f); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 188); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("AstralCannonExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 50, default(Color), 1f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 0, default(Color), 1.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 50, default(Color), 1f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - } - } + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 50, default(Color), 1f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralOrange"), 0f, 0f, 0, default(Color), 1.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, mod.DustType("AstralBlue"), 0f, 0f, 50, default(Color), 1f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + } } \ No newline at end of file diff --git a/Projectiles/Astral/HeavenfallenStardisk.cs b/Projectiles/Astral/HeavenfallenStardisk.cs index af48d6cd4c..993f163b3f 100644 --- a/Projectiles/Astral/HeavenfallenStardisk.cs +++ b/Projectiles/Astral/HeavenfallenStardisk.cs @@ -10,17 +10,17 @@ namespace CalamityMod.Projectiles.Astral { public class HeavenfallenStardisk : ModProjectile { - + public bool explode = false; - + public override void SetStaticDefaults() { DisplayName.SetDefault("Heavenfallen Stardisk"); } - + public override void SetDefaults() { - projectile.width = 38; + projectile.width = 34; projectile.height = 34; projectile.alpha = 255; projectile.friendly = true; diff --git a/Projectiles/Astral/Hive.cs b/Projectiles/Astral/Hive.cs index 4ea9e12a0d..a4e2ffc032 100644 --- a/Projectiles/Astral/Hive.cs +++ b/Projectiles/Astral/Hive.cs @@ -60,7 +60,44 @@ namespace CalamityMod.Projectiles.Astral projectile.velocity.Y = 10f; } - if (projectile.owner == Main.myPlayer) + int target = 0; + float num633 = 800f; + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (Main.player[projectile.owner].HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + target = npc.whoAmI; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + target = num645; + } + } + } + } + if (projectile.owner == Main.myPlayer && flag25) { if (projectile.ai[0] != 0f) { @@ -72,7 +109,7 @@ namespace CalamityMod.Projectiles.Astral { float velocityX = Main.rand.NextFloat(-0.4f, 0.4f); float velocityY = Main.rand.NextFloat(-0.3f, -0.5f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocityX, velocityY, mod.ProjectileType("Hiveling"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, velocityX, velocityY, mod.ProjectileType("Hiveling"), projectile.damage, projectile.knockBack, projectile.owner, (float)target, 0f); } } } diff --git a/Projectiles/Astral/Hiveling.cs b/Projectiles/Astral/Hiveling.cs index e39ebcdb1d..fb0bed027b 100644 --- a/Projectiles/Astral/Hiveling.cs +++ b/Projectiles/Astral/Hiveling.cs @@ -46,20 +46,18 @@ namespace CalamityMod.Projectiles.Astral float centerY = projectile.Center.Y; float num474 = 1200f; bool homeIn = false; - for (int i = 0; i < 200; i++) + int target = (int)projectile.ai[0]; + if (Main.npc[target].CanBeChasedBy(projectile, false)) { - if (Main.npc[i].CanBeChasedBy(projectile, false)) + float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); + float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].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) { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].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; - centerX = num476; - centerY = num477; - homeIn = true; - } + num474 = num478; + centerX = num476; + centerY = num477; + homeIn = true; } } if (homeIn) @@ -74,7 +72,6 @@ namespace CalamityMod.Projectiles.Astral num485 *= num486; projectile.velocity.X = (projectile.velocity.X * 30f + num484) / 31f; projectile.velocity.Y = (projectile.velocity.Y * 30f + num485) / 31f; - return; } } diff --git a/Projectiles/Astral/RadiantStar.cs b/Projectiles/Astral/RadiantStar.cs index dcf026de8f..0fdfc828bb 100644 --- a/Projectiles/Astral/RadiantStar.cs +++ b/Projectiles/Astral/RadiantStar.cs @@ -8,70 +8,104 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Astral { - public class RadiantStar : ModProjectile - { - public override void SetStaticDefaults() + public class RadiantStar : ModProjectile + { + public override void SetStaticDefaults() { DisplayName.SetDefault("Radiant Star"); } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 4; - projectile.timeLeft = 300; + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.penetrate = 4; + projectile.timeLeft = 300; projectile.GetGlobalProjectile(mod).rogue = true; } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if(projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - projectile.ai[1] += 1f; - if (projectile.ai[1] == 25f) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(50); - if (projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + if (projectile.ai[0] == 1f) + { + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 600f; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !Main.npc[num475].boss) + { + 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) + { + if (Main.npc[num475].position.X < num472) + { + Main.npc[num475].velocity.X += 0.25f; + } + else + { + Main.npc[num475].velocity.X -= 0.25f; + } + if (Main.npc[num475].position.Y < num473) + { + Main.npc[num475].velocity.Y += 0.25f; + } + else + { + Main.npc[num475].velocity.Y -= 0.25f; + } + } + } + } + } + projectile.ai[1] += 1f; + if (projectile.ai[1] == 25f) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(50); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj + 1; i++) + { + Vector2 speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); while (speed.X == 0f && speed.Y == 0f) { speed = new Vector2((float)Main.rand.Next(-50, 51), (float)Main.rand.Next(-50, 51)); } speed.Normalize(); speed *= ((float)Main.rand.Next(30, 61) * 0.1f) * 2.5f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("RadiantStar2"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, speed.X, speed.Y, mod.ProjectileType("RadiantStar2"), projectile.damage, projectile.knockBack, projectile.owner, + (projectile.ai[0] == 1f ? 1f : 0f), 0f); } Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("RadiantExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); projectile.active = false; - return; } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } \ No newline at end of file diff --git a/Projectiles/Astral/RadiantStar2.cs b/Projectiles/Astral/RadiantStar2.cs index 9976629ddd..3fb72e88f8 100644 --- a/Projectiles/Astral/RadiantStar2.cs +++ b/Projectiles/Astral/RadiantStar2.cs @@ -8,79 +8,117 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Astral { - public class RadiantStar2 : ModProjectile - { - public override void SetStaticDefaults() + public class RadiantStar2 : ModProjectile + { + public override void SetStaticDefaults() { DisplayName.SetDefault("Radiant Star"); } - - public override void SetDefaults() - { - projectile.width = 24; - projectile.height = 24; - projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 300; + + public override void SetDefaults() + { + projectile.width = 24; + projectile.height = 24; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; projectile.GetGlobalProjectile(mod).rogue = true; } - - public override void AI() - { + + public override void AI() + { projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if(projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - float centerX = projectile.Center.X; - float centerY = projectile.Center.Y; - float num474 = 600f; - bool homeIn = false; - for (int i = 0; i < 200; i++) + if (projectile.spriteDirection == -1) { - if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + projectile.rotation -= 1.57f; + } + if (projectile.ai[0] == 1f) + { + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float npcCenterX = 0f; + float npcCenterY = 0f; + float num474 = 600f; + for (int num475 = 0; num475 < 200; num475++) { - float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); - float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].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) + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !Main.npc[num475].boss) { - num474 = num478; - centerX = num476; - centerY = num477; - homeIn = true; + npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + if (num478 < num474) + { + if (Main.npc[num475].position.X < num472) + { + Main.npc[num475].velocity.X += 0.25f; + } + else + { + Main.npc[num475].velocity.X -= 0.25f; + } + if (Main.npc[num475].position.Y < num473) + { + Main.npc[num475].velocity.Y += 0.25f; + } + else + { + Main.npc[num475].velocity.Y -= 0.25f; + } + } } } } - if (homeIn) + else { - float num483 = 24f; - Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num484 = centerX - vector35.X; - float num485 = centerY - 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; - return; + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 600f; + bool homeIn = false; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].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; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 24f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - 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 bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void Kill(int timeLeft) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, mod.DustType("AstralBlue"), projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/BigFlare2.cs b/Projectiles/Boss/BigFlare2.cs index 855e12b602..54a7818f86 100644 --- a/Projectiles/Boss/BigFlare2.cs +++ b/Projectiles/Boss/BigFlare2.cs @@ -106,7 +106,6 @@ namespace CalamityMod.Projectiles.Boss public override void Kill(int timeLeft) { - bool revenge = CalamityWorld.revenge; Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 20); int num226 = 36; for (int num227 = 0; num227 < num226; num227++) @@ -150,7 +149,7 @@ namespace CalamityMod.Projectiles.Boss break; } } - int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado2"), 0, 4f, Main.myPlayer, 16f, 20f + (revenge ? 2f : 0f)); + int num236 = Projectile.NewProjectile((float)(num232 * 16 + 8), (float)(num231 * 16 - 24), 0f, 0f, mod.ProjectileType("Infernado2"), 0, 4f, Main.myPlayer, 16f, 30f); Main.projectile[num236].netUpdate = true; } } diff --git a/Projectiles/Boss/BrimstoneFireblast.cs b/Projectiles/Boss/BrimstoneFireblast.cs index 1ef3678c0c..bd3a2567ec 100644 --- a/Projectiles/Boss/BrimstoneFireblast.cs +++ b/Projectiles/Boss/BrimstoneFireblast.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Projectiles.Boss projectile.height = 50; projectile.hostile = true; projectile.ignoreWater = true; + projectile.tileCollide = false; projectile.penetrate = 1; projectile.alpha = 120; cooldownSlot = 1; @@ -28,7 +29,11 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.frameCounter++; + if (projectile.ai[0] == 1f) + { + projectile.tileCollide = true; + } + projectile.frameCounter++; if (projectile.frameCounter > 4) { projectile.frame++; diff --git a/Projectiles/Boss/BrimstoneGigaBlast.cs b/Projectiles/Boss/BrimstoneGigaBlast.cs index 270f4d6de7..c96d8bd05e 100644 --- a/Projectiles/Boss/BrimstoneGigaBlast.cs +++ b/Projectiles/Boss/BrimstoneGigaBlast.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.frameCounter++; + projectile.frameCounter++; if (projectile.frameCounter > 4) { projectile.frame++; diff --git a/Projectiles/Boss/BrimstoneLaserSplit.cs b/Projectiles/Boss/BrimstoneLaserSplit.cs index 3f66d94133..bd955aa5bc 100644 --- a/Projectiles/Boss/BrimstoneLaserSplit.cs +++ b/Projectiles/Boss/BrimstoneLaserSplit.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.scale = 2f; projectile.ignoreWater = true; + projectile.tileCollide = false; projectile.penetrate = 1; projectile.timeLeft = 300; projectile.alpha = 120; @@ -28,6 +29,10 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (projectile.timeLeft < 180) + { + projectile.tileCollide = true; + } int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); projectile.ai[1] += 1f; if (projectile.ai[1] < 210f && projectile.ai[1] > 90f) diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index 65009d71c1..a281dffe0f 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Boss projectile.height = 26; projectile.hostile = true; projectile.alpha = 255; - projectile.penetrate = 1; + projectile.penetrate = -1; projectile.tileCollide = false; projectile.timeLeft = 1200; } @@ -59,7 +59,16 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color lightColor) + public override bool CanDamage() + { + if (projectile.timeLeft > 1100) + { + return false; + } + return true; + } + + public override Color? GetAlpha(Color lightColor) { if (projectile.timeLeft < 85) { diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index dfe22345bc..0d242e73ec 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -41,10 +41,20 @@ namespace CalamityMod.Projectiles.Boss { projectile.frame = 0; } - if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft < 420) - { - projectile.velocity *= 1.05f; - } + if (projectile.ai[0] == 1f) + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 8f && projectile.timeLeft < 630) + { + projectile.velocity *= 1.025f; + } + } + else + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 16f && projectile.timeLeft < 420) + { + projectile.velocity *= 1.05f; + } + } Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); } diff --git a/Projectiles/Boss/Infernado2.cs b/Projectiles/Boss/Infernado2.cs index d34eced8e1..573cea39a9 100644 --- a/Projectiles/Boss/Infernado2.cs +++ b/Projectiles/Boss/Infernado2.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss projectile.ignoreWater = true; projectile.penetrate = -1; projectile.alpha = 255; - projectile.timeLeft = 420; + projectile.timeLeft = 840; cooldownSlot = 1; } @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Boss { int num613 = 30; int num614 = 30; - float num615 = 3f; //2.5 + float num615 = 2f; //2.5 int num616 = 320; int num617 = 88; if (projectile.velocity.X != 0f) diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index 8bc9459c3a..027e37f090 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.penetrate = -1; projectile.timeLeft = 1200; + projectile.scale = 1.5f; cooldownSlot = 0; } diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index 2c222ee022..887631d8d9 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Projectiles.Boss public override bool OnTileCollide(Vector2 oldVelocity) { projectile.penetrate--; - if (projectile.penetrate <= 0) + projectile.localAI[1] -= 180f; + if (projectile.penetrate <= 0) { projectile.Kill(); } @@ -54,6 +55,21 @@ namespace CalamityMod.Projectiles.Boss Main.PlaySound(SoundID.Item20, projectile.position); } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 300f) + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 24f) + { + projectile.velocity *= 1.025f; + } + if (projectile.localAI[1] > 480f) + { + projectile.localAI[1] = 0f; + projectile.penetrate--; + projectile.velocity.X = -projectile.velocity.X; + projectile.velocity.Y = -projectile.velocity.Y; + } + } projectile.localAI[0] += 1f; if (projectile.localAI[0] > 9f) { diff --git a/Projectiles/Boss/PhantomShot2.cs b/Projectiles/Boss/PhantomShot2.cs index 099b54ac7f..422bb8714f 100644 --- a/Projectiles/Boss/PhantomShot2.cs +++ b/Projectiles/Boss/PhantomShot2.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Projectiles.Boss public override bool OnTileCollide(Vector2 oldVelocity) { projectile.penetrate--; - if (projectile.penetrate <= 0) + projectile.localAI[1] -= 120f; + if (projectile.penetrate <= 0) { projectile.Kill(); } @@ -54,6 +55,21 @@ namespace CalamityMod.Projectiles.Boss Main.PlaySound(SoundID.Item20, projectile.position); } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 240f) + { + if (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y) < 30f) + { + projectile.velocity *= 1.025f; + } + if (projectile.localAI[1] > 420f) + { + projectile.localAI[1] = 0f; + projectile.penetrate--; + projectile.velocity.X = -projectile.velocity.X; + projectile.velocity.Y = -projectile.velocity.Y; + } + } projectile.localAI[0] += 1f; if (projectile.localAI[0] > 9f) { diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs index 51b99704ac..f86943ef40 100644 --- a/Projectiles/Boss/YharonFireball.cs +++ b/Projectiles/Boss/YharonFireball.cs @@ -7,91 +7,85 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class YharonFireball : ModProjectile - { - public float speedX = -3f; - public float speedY = -50f; - public float speedX2 = -5f; - public float speedY2 = -75f; + public class YharonFireball : ModProjectile + { + private float speedX = -3f; + private float speedX2 = -5f; - public override void SetStaticDefaults() + public override void SetStaticDefaults() { DisplayName.SetDefault("Dragon Fireball"); } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 120; - projectile.aiStyle = 1; - aiType = 686; + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 30; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.timeLeft = 120; + projectile.aiStyle = 1; + aiType = 686; cooldownSlot = 1; } - public override bool PreAI() - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] == 36f) - { - projectile.localAI[0] = 0f; - for (int l = 0; l < 12; l++) - { - Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default(Vector2)) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); - int num9 = Dust.NewDust(projectile.Center, 0, 0, 55, 0f, 0f, 160, default(Color), 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; - } - } - return true; - } + public override bool PreAI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 36f) + { + projectile.localAI[0] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default(Vector2)) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 55, 0f, 0f, 160, default(Color), 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + return true; + } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) + { + return new Color(255, Main.DiscoG, 53, projectile.alpha); + } - public override void Kill(int timeLeft) - { - for (int x = 0; x < 3; x++) - { - Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX, speedY, mod.ProjectileType("YharonFireball2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); - speedX += 3f; - } - if (CalamityWorld.death) - { - for (int x = 0; x < 3; x++) - { - Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX2, speedY2, mod.ProjectileType("YharonFireball2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); - speedX2 += 5f; - } - } - projectile.position = projectile.Center; - projectile.width = (projectile.height = 144); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } + public override void Kill(int timeLeft) + { + for (int x = 0; x < 3; x++) + { + Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX, -50f, mod.ProjectileType("YharonFireball2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + speedX += 3f; + } + for (int x = 0; x < 2; x++) + { + Projectile.NewProjectile((int)projectile.Center.X, (int)projectile.Center.Y, speedX2, -75f, mod.ProjectileType("YharonFireball2"), projectile.damage, 0f, Main.myPlayer, 0f, 0f); + speedX2 += 10f; + } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 144); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + } } \ No newline at end of file diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index cde48e815e..1949c32f29 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss projectile.hostile = true; projectile.alpha = 255; projectile.penetrate = -1; - projectile.timeLeft = 1200; + projectile.timeLeft = 3600; cooldownSlot = 1; } @@ -92,7 +92,16 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color lightColor) + public override bool CanDamage() + { + if (projectile.velocity.Y < -16f) + { + return false; + } + return true; + } + + public override Color? GetAlpha(Color lightColor) { return new Color(255, Main.DiscoG, 53, projectile.alpha); } diff --git a/Projectiles/Boss/YharonFireballHoming.cs b/Projectiles/Boss/YharonFireballHoming.cs deleted file mode 100644 index e8fa6c8d89..0000000000 --- a/Projectiles/Boss/YharonFireballHoming.cs +++ /dev/null @@ -1,171 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class YharonFireballHoming : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Homing Dragon Fireball"); - } - - public override void SetDefaults() - { - projectile.width = 30; - projectile.height = 30; - projectile.hostile = true; - projectile.alpha = 255; - projectile.penetrate = -1; - projectile.timeLeft = 1200; - cooldownSlot = 1; - } - - public override void AI() - { - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); - } - projectile.alpha -= 40; - if (projectile.alpha < 0) - { - projectile.alpha = 0; - } - if (projectile.ai[0] == 0f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= (CalamityWorld.death ? 330f : 110f)) - { - projectile.localAI[0] = 0f; - projectile.ai[0] = 1f; - projectile.ai[1] = -projectile.ai[1]; - projectile.netUpdate = true; - } - projectile.velocity.X = projectile.velocity.RotatedBy((double)projectile.ai[1], default(Vector2)).X; - projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); - projectile.velocity.Y = projectile.velocity.Y - 0.08f; - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - } - if (projectile.velocity.Y < -7f) - { - projectile.velocity.Y = -7f; - } - } - else if (projectile.ai[0] == 1f) - { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 90f) - { - projectile.localAI[0] = 0f; - projectile.ai[0] = 2f; - projectile.ai[1] = (float)Player.FindClosest(projectile.position, projectile.width, projectile.height); - projectile.netUpdate = true; - } - projectile.velocity.X = projectile.velocity.RotatedBy((double)projectile.ai[1], default(Vector2)).X; - projectile.velocity.X = MathHelper.Clamp(projectile.velocity.X, -6f, 6f); - projectile.velocity.Y = projectile.velocity.Y - 0.08f; - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - 0.2f; - } - if (projectile.velocity.Y < -7f) - { - projectile.velocity.Y = -7f; - } - } - else if (projectile.ai[0] == 2f) - { - float speed = 12f; - Vector2 vector70 = Main.player[(int)projectile.ai[1]].Center - projectile.Center; - if (vector70.Length() < 60f) - { - projectile.Kill(); - return; - } - vector70.Normalize(); - vector70 *= 14f; - vector70 = Vector2.Lerp(projectile.velocity, vector70, 0.6f); - if (vector70.Y < speed) - { - vector70.Y = speed; - } - float num804 = 0.8f; //0.4 - if (projectile.velocity.X < vector70.X) - { - projectile.velocity.X = projectile.velocity.X + num804; - if (projectile.velocity.X < 0f && vector70.X > 0f) - { - projectile.velocity.X = projectile.velocity.X + num804; - } - } - else if (projectile.velocity.X > vector70.X) - { - projectile.velocity.X = projectile.velocity.X - num804; - if (projectile.velocity.X > 0f && vector70.X < 0f) - { - projectile.velocity.X = projectile.velocity.X - num804; - } - } - if (projectile.velocity.Y < vector70.Y) - { - projectile.velocity.Y = projectile.velocity.Y + num804; - if (projectile.velocity.Y < 0f && vector70.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num804; - } - } - else if (projectile.velocity.Y > vector70.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num804; - if (projectile.velocity.Y > 0f && vector70.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num804; - } - } - } - if (projectile.alpha < 40) - { - int num805 = Dust.NewDust(projectile.Center - Vector2.One * 5f, 10, 10, 55, -projectile.velocity.X / 3f, -projectile.velocity.Y / 3f, 50, default(Color), 1.2f); - Main.dust[num805].noGravity = true; - } - projectile.rotation = projectile.velocity.ToRotation() + 1.57079637f; - } - - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, Main.DiscoG, 53, projectile.alpha); - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14, 1f, 0f); - projectile.position = projectile.Center; - projectile.width = (projectile.height = 188); - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 2; num193++) - { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); - } - for (int num194 = 0; num194 < 20; num194++) - { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 0, default(Color), 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 55, 0f, 0f, 50, default(Color), 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; - } - projectile.Damage(); - } - } -} \ No newline at end of file diff --git a/Projectiles/Boss/YharonFireballHoming.png b/Projectiles/Boss/YharonFireballHoming.png deleted file mode 100644 index 6a4eedebff..0000000000 Binary files a/Projectiles/Boss/YharonFireballHoming.png and /dev/null differ diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index fee999ba13..b3da0c9e55 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -8,6 +8,8 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod; +using CalamityMod.NPCs; +using CalamityMod.World; using CalamityMod.NPCs.TheDevourerofGods; using CalamityMod.Items.Armor; using CalamityMod.Items.CalamityCustomThrowingDamage; @@ -28,21 +30,90 @@ namespace CalamityMod.Projectiles public bool rogue = false; - public bool setDamageValues = true; + public bool trueMelee = false; + + private bool setDamageValues = true; + + public bool forceMelee = false; + + public bool forceRanged = false; + + public bool forceMagic = false; + + public bool forceRogue = false; public float spawnedPlayerMinionDamageValue = 1f; public int spawnedPlayerMinionProjectileDamageValue = 0; - public int counter = 0; + private int counter = 0; - public int counter2 = 0; + private int counter2 = 0; + + private int defDamage = 0; + + #region SetDefaults + public override void SetDefaults(Projectile projectile) + { + switch (projectile.type) + { + case ProjectileID.Spear: + case ProjectileID.ChainKnife: + case ProjectileID.TheRottedFork: + case ProjectileID.BallOHurt: + case ProjectileID.TheMeatball: + case ProjectileID.Swordfish: + case ProjectileID.Arkhalis: + case ProjectileID.BlueMoon: + case ProjectileID.DarkLance: + case ProjectileID.Sunfury: + case ProjectileID.Anchor: + case ProjectileID.BoxingGlove: + case ProjectileID.CobaltNaginata: + case ProjectileID.PalladiumPike: + case ProjectileID.MythrilHalberd: + case ProjectileID.OrichalcumHalberd: + case ProjectileID.AdamantiteGlaive: + case ProjectileID.TitaniumTrident: + case ProjectileID.TheDaoofPow: + case ProjectileID.GolemFist: + case ProjectileID.Gungnir: + case ProjectileID.ObsidianSwordfish: + case ProjectileID.ChainGuillotine: + case ProjectileID.MonkStaffT3: + case ProjectileID.MonkStaffT1: + case ProjectileID.SolarWhipSword: + trueMelee = true; + break; + } + } + #endregion #region AI public override void AI(Projectile projectile) { + if (defDamage == 0) + defDamage = projectile.damage; + + if (NPC.downedMoonlord) + { + if (CalamityMod.dungeonProjectileBuffList.Contains(projectile.type)) + projectile.damage = defDamage + 60; + } + if (CalamityWorld.downedDoG && (Main.pumpkinMoon || Main.snowMoon)) + { + if (CalamityMod.eventProjectileBuffList.Contains(projectile.type)) + projectile.damage = defDamage + 90; + } + else if (CalamityWorld.buffedEclipse && Main.eclipse) + { + if (CalamityMod.eventProjectileBuffList.Contains(projectile.type)) + projectile.damage = defDamage + 120; + } + if (projectile.modProjectile != null && projectile.modProjectile.mod.Name.Equals("CalamityMod")) goto SKIP_CALAMITY; + if ((projectile.minion || projectile.sentry) && !ProjectileID.Sets.StardustDragon[projectile.type]) //For all other mods and vanilla, exclude dragon due to bugs { if (setDamageValues) @@ -58,115 +129,61 @@ namespace CalamityMod.Projectiles } } SKIP_CALAMITY: - if (projectile.type == ProjectileID.HallowStar) + + if (forceMelee) { - if (projectile.ai[0] == 1f) - { - projectile.ranged = false; - projectile.melee = true; - } - else if (projectile.ai[0] == 2f) - { - projectile.ranged = false; - rogue = true; - } + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = true; + projectile.ranged = false; + projectile.magic = false; + rogue = false; } - else if (projectile.type == ProjectileID.FallingStar) + else if (forceRanged) { - if (projectile.ai[0] == 2f) - { - rogue = true; - } + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = true; + projectile.magic = false; + rogue = false; } - else if (projectile.type == ProjectileID.Meteor1 || projectile.type == ProjectileID.Meteor2 || projectile.type == ProjectileID.Meteor3) + else if (forceMagic) { - if (projectile.ai[0] == 1f) - { - projectile.magic = false; - projectile.melee = true; - projectile.tileCollide = false; - } + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = false; + projectile.magic = true; + rogue = false; } - else if (projectile.type == ProjectileID.GoldenShowerFriendly) + else if (forceRogue) { - if (projectile.ai[0] == 1f) - { - projectile.magic = false; - projectile.melee = true; - } + projectile.hostile = false; + projectile.friendly = true; + projectile.melee = false; + projectile.ranged = false; + projectile.magic = false; + rogue = true; } - else if (projectile.type == ProjectileID.MiniSharkron) + + if (projectile.type == ProjectileID.NettleBurstRight || projectile.type == ProjectileID.NettleBurstLeft || projectile.type == ProjectileID.NettleBurstEnd) { - if (projectile.ai[0] == 1f) - projectile.melee = true; - else if (projectile.ai[0] == 2f) - projectile.ranged = true; + if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("ThornBlossom")) + projectile.penetrate = 1; } - else if (projectile.type == ProjectileID.LostSoulFriendly) - { - if (projectile.ai[0] == 1f) - { - projectile.magic = false; - projectile.ranged = true; - } - } - else if (projectile.type == ProjectileID.LunarFlare) - { - if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("StellarStriker")) - { - projectile.magic = false; - projectile.melee = true; - } - } - else if (projectile.type == ProjectileID.RubyBolt || projectile.type == ProjectileID.SapphireBolt || projectile.type == ProjectileID.AmethystBolt) - { - if (projectile.ai[0] == 1f) - { - projectile.magic = false; - projectile.melee = true; - } - } - else if (projectile.type == ProjectileID.SolarWhipSwordExplosion) - { - if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("TruePaladinsHammer") || - Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("FlameScythe")) - { - projectile.melee = false; - } - else if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) - { - projectile.melee = false; - projectile.ranged = true; - } - else if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("PurgeGuzzler") || - Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("Lazhar")) - { - projectile.melee = false; - projectile.magic = true; - } - } - else if (projectile.type == ProjectileID.GiantBee || projectile.type == ProjectileID.Bee || projectile.type == ProjectileID.Wasp) + else if (projectile.type == ProjectileID.GiantBee || projectile.type == ProjectileID.Bee) { if (projectile.timeLeft > 570) //all of these have a time left of 600 or 660 { - if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("PlagueKeeper")) - { - projectile.magic = false; - projectile.melee = true; - } - else if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("TheSwarmer")) - { - projectile.magic = true; - } - else if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("TheHive") || - Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("Malevolence") || - Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == ItemID.BeesKnees) + if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == ItemID.BeesKnees) { projectile.magic = false; projectile.ranged = true; } } } + if (Main.player[projectile.owner].GetModPlayer(mod).eQuiver && projectile.ranged && projectile.friendly && CalamityMod.rangedProjectileExceptionList.TrueForAll(x => projectile.type != x)) { @@ -194,6 +211,21 @@ namespace CalamityMod.Projectiles } } } + + if (Main.player[projectile.owner].GetModPlayer(mod).fungalSymbiote && trueMelee) + { + counter++; + if (counter >= 6) + { + counter = 0; + if (projectile.owner == Main.myPlayer && Main.player[projectile.owner].ownedProjectileCounts[ProjectileID.Mushroom] < 30) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ProjectileID.Mushroom, + (int)((double)projectile.damage * 0.25), 0f, projectile.owner, 0f, 0f); + } + } + } + if (Main.player[projectile.owner].GetModPlayer(mod).nanotech && rogue && projectile.friendly) { counter++; @@ -207,6 +239,7 @@ namespace CalamityMod.Projectiles } } } + if (Main.player[projectile.owner].GetModPlayer(mod).daedalusSplit && rogue && projectile.friendly) { counter2++; @@ -230,6 +263,19 @@ namespace CalamityMod.Projectiles } } } + + if (Main.player[projectile.owner].GetModPlayer(mod).theBeeDamage > 0 && projectile.owner == Main.myPlayer && projectile.friendly && projectile.damage > 0 && + (projectile.melee || projectile.ranged || projectile.magic || rogue)) + { + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 91, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default(Color), 0.5f); + Main.dust[dust].noGravity = true; + } + if (Main.player[projectile.owner].GetModPlayer(mod).providenceLore && projectile.owner == Main.myPlayer && projectile.friendly && projectile.damage > 0 && + (projectile.melee || projectile.ranged || projectile.magic || rogue)) + { + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default(Color), 0.5f); + Main.dust[dust].noGravity = true; + } } #endregion @@ -244,213 +290,19 @@ namespace CalamityMod.Projectiles { if (projectile.type == ProjectileID.PureSpray) { - CalamityWorld.ConvertFromAstral(i, j, ConvertType.Pure); + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Pure); } if (projectile.type == ProjectileID.CorruptSpray) { - CalamityWorld.ConvertFromAstral(i, j, ConvertType.Corrupt); + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Corrupt); } if (projectile.type == ProjectileID.CrimsonSpray) { - CalamityWorld.ConvertFromAstral(i, j, ConvertType.Crimson); + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Crimson); } if (projectile.type == ProjectileID.HallowSpray) { - CalamityWorld.ConvertFromAstral(i, j, ConvertType.Hallow); - } - } - } - } - #endregion - - #region ModifyHitNPC - public override void ModifyHitNPC(Projectile projectile, NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) - { - if (projectile.ranged) - { - //BULLETS - - //musket ball: base 100 + 7 = 107 - //silver: base 100 + 9 = 109 - //meteor shot: base 100 + 9 = 109 pierces once - //acceleration: base 100 + bullet damage 9 = 109 speeds up while travelling - //flash: base 100 + bullet damage 7 = 107 + (flash damage 107 * 0.25 = 26) = 133 AoE confusion - //superball: base 100 + bullet damage 6 = 106 bounces a fucking shitload of times and speeds up - //enhanced nano: base 100 + bullet damage 12 = 112 + (nanobot damage 112 * 0.3 = 33 * 2 nanobots = 66) = 178 - //crystal: base 100 + bullet damage 9 = 109 + (crystal shard damage 109 * 0.6 = 65 * 0.6 = 39 * 3 total shards = 117) = 226 - //frostspark: base 100 + bullet damage 11 = 111 + (explosion damage 111 * 0.5 = 55) = 166 - //icy: base 100 + 10 bullet damage = 110 + (ice shard damage 110 * 0.5 = 55 * 0.6 = 33 * 2 total shards = 66) = 176 - //verium: base 100 + bullet damage 8 = 108 * 0.8 = 86 homing - //chloro: base 100 + bullet damage 10 = 110 * 0.8 = 88 homing - //terra: base 100 + bullet damage 9 = 109 + (terra shard damage 109 * 0.5 = 54 * 2 total shards = 106) = 215 - //acid: base 100 + bullet damage 36 = 136 does more based on enemy defense - //hyperius: base 100 + bullet damage 21 = 121 + (hyperius second bullet damage 121 * 0.8 = 96) = 217 - //holy fire: base 100 + bullet damage 27 = 127 + (explosion damage 127 * 0.85 = 107) = 234 - - //ARROWS - - //holy arrow: base 100 + arrow damage 13 = 113 + (star damage 113 * 0.5 = 56 * 0.7 = 39 * 2 total stars = 78) = 191 - //terra arrow: base 100 + arrow damage 9 = 109 + (terra arrow split damage 109 * 0.5 = 54 * 2 total arrows = 106) = 215 - //elysian arrow: base 100 + arrow damage 20 = 120 + meteor damage 120 = 240 - //napalm arrow: base 100 + arrow damage 13 = 113 + (fire shard damage 113 * 0.3 = 33 * 3 total shards = 99) = 212 - //icicle arrow: base 100 + arrow damage 14 = 114 + (ice shard damage 114 * 0.5 = 57 * 0.6 = 34 * 3 total shards = 102) = 216 - //bloodfire arrow: base 100 + arrow damage 40 = 140 but it heals so it's alright - //arctic arrow: base 100 + arrow damage 16 = 116 but it freezes enemies so it's alright - //vanquisher arrow: base 100 + arrow damage 33 = 133 + split arrow damage 93 = 226 fine for endgame arrow - switch (projectile.type) - { - case ProjectileID.CrystalShard: - damage = (int)((double)damage * 0.6); - break; - case ProjectileID.ChlorophyteBullet: - damage = (int)((double)damage * 0.8); - break; - case ProjectileID.HallowStar: - damage = (int)((double)damage * 0.7); - break; - } - if (projectile.type == mod.ProjectileType("VeriumBullet")) - { - damage = (int)((double)damage * 0.8); - } - else if (projectile.type == mod.ProjectileType("FrostsparkBullet")) - { - if (target.buffImmune[mod.BuffType("GlacialState")]) - { - damage = (int)((double)damage * 1.2); - } - } - else if (projectile.type == mod.ProjectileType("AcidBullet")) - { - int defenseAdd = (int)((double)target.defense * 0.1); //100 defense * 0.1 = 10 - damage = damage + defenseAdd; - } - } - if (projectile.owner == Main.myPlayer) - { - if (rogue) - { - crit = (Main.rand.Next(1, 101) < CalamityCustomThrowingDamagePlayer.ModPlayer(Main.player[projectile.owner]).throwingCrit); - } - if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type)) - { - Player player = Main.player[projectile.owner]; - if (!player.inventory[player.selectedItem].summon && - (player.inventory[player.selectedItem].melee || - player.inventory[player.selectedItem].ranged || - player.inventory[player.selectedItem].magic || - player.inventory[player.selectedItem].thrown) && - player.inventory[player.selectedItem].hammer == 0 && - player.inventory[player.selectedItem].pick == 0 && - player.inventory[player.selectedItem].axe == 0) - { - damage = (int)((double)damage * 0.6); - } - else - { - damage = (int)((double)damage * 1.1); - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).screwdriver) - { - if (projectile.penetrate > 1 || projectile.penetrate == -1) - { - damage = (int)((double)damage * 1.1); - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).sPower) - { - if (projectile.minion || CalamityMod.projectileMinionList.Contains(projectile.type)) - { - damage = (int)((double)damage * 1.1); - } - } - if (CalamityWorld.revenge) - { - bool DHorHoD = (Main.player[projectile.owner].GetModPlayer(mod).draedonsHeart || - Main.player[projectile.owner].GetModPlayer(mod).heartOfDarkness); - if (Main.player[projectile.owner].GetModPlayer(mod).rageMode && - Main.player[projectile.owner].GetModPlayer(mod).adrenalineMode) - { - if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || - projectile.melee || projectile.ranged || projectile.magic || rogue) - { - damage = (int)((double)damage * - (CalamityWorld.death ? (DHorHoD ? 9.9 : 9.0) : (DHorHoD ? 3.3 : 3.0))); - } - } - else if (Main.player[projectile.owner].GetModPlayer(mod).rageMode) - { - if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || - projectile.melee || projectile.ranged || projectile.magic || rogue) - { - double rageDamageBoost = 0.0 + - (Main.player[projectile.owner].GetModPlayer(mod).rageBoostOne ? (CalamityWorld.death ? 0.6 : 0.15) : 0.0) + //3.6 or 1.65 - (Main.player[projectile.owner].GetModPlayer(mod).rageBoostTwo ? (CalamityWorld.death ? 0.6 : 0.15) : 0.0) + //4.2 or 1.8 - (Main.player[projectile.owner].GetModPlayer(mod).rageBoostThree ? (CalamityWorld.death ? 0.6 : 0.15) : 0.0); //4.8 or 1.95 - double rageDamage = - (CalamityWorld.death ? (DHorHoD ? 3.3 : 3.0) : (DHorHoD ? 1.65 : 1.5)) + rageDamageBoost; - damage = (int)((double)damage * rageDamage); - } - } - else if (Main.player[projectile.owner].GetModPlayer(mod).adrenalineMode) - { - if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || - projectile.melee || projectile.ranged || projectile.magic || rogue) - { - damage = (int)((double)damage * ((CalamityWorld.death ? 7.0 : 2.5) * Main.player[projectile.owner].GetModPlayer(mod).adrenalineDmgMult)); - } - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).uberBees && - (projectile.type == ProjectileID.GiantBee || projectile.type == ProjectileID.Bee || projectile.type == ProjectileID.Wasp)) - { - if (Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("TheSwarmer") || - Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type == mod.ItemType("PlagueKeeper")) - { - damage = damage + Main.rand.Next(10, 21); - } - else - { - damage = damage + Main.rand.Next(70, 101); - projectile.penetrate = 1; - } - } - } - if (Main.player[projectile.owner].GetModPlayer(mod).astralStarRain && crit && - Main.player[projectile.owner].GetModPlayer(mod).astralStarRainCooldown <= 0) - { - if (projectile.owner == Main.myPlayer) - { - Main.player[projectile.owner].GetModPlayer(mod).astralStarRainCooldown = 60; - for (int n = 0; n < 3; n++) - { - float x = target.position.X + (float)Main.rand.Next(-400, 400); - float y = target.position.Y - (float)Main.rand.Next(500, 800); - Vector2 vector = new Vector2(x, y); - float num13 = target.position.X + (float)(target.width / 2) - vector.X; - float num14 = target.position.Y + (float)(target.height / 2) - vector.Y; - num13 += (float)Main.rand.Next(-100, 101); - int num15 = 25; - int projectileType = Main.rand.Next(3); - if (projectileType == 0) - { - projectileType = mod.ProjectileType("AstralStar"); - } - else if (projectileType == 1) - { - projectileType = 92; - } - else - { - projectileType = 12; - } - float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); - num16 = (float)num15 / num16; - num13 *= num16; - num14 *= num16; - int num17 = Projectile.NewProjectile(x, y, num13, num14, projectileType, 75, 5f, projectile.owner, 0f, 0f); - Main.projectile[num17].ranged = false; + WorldGenerationMethods.ConvertFromAstral(i, j, ConvertType.Hallow); } } } @@ -482,14 +334,9 @@ namespace CalamityMod.Projectiles } Main.player[Main.myPlayer].lifeSteal -= num; } - if (Main.player[projectile.owner].GetModPlayer(mod).uberBees && - (projectile.type == 566 || projectile.type == 181 || projectile.type == 189)) - { - target.AddBuff(mod.BuffType("Plague"), 360); - } if (Main.player[projectile.owner].GetModPlayer(mod).alchFlask && - (projectile.magic || rogue || projectile.melee || projectile.minion || projectile.ranged) && - Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("PlagueSeeker")] < 6) + (projectile.magic || rogue || projectile.melee || projectile.minion || projectile.ranged || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type)) && + Main.player[projectile.owner].ownedProjectileCounts[mod.ProjectileType("PlagueSeeker")] < 6) { int newDamage = (int)((double)projectile.damage * 0.25); if (newDamage > 30) @@ -645,10 +492,10 @@ namespace CalamityMod.Projectiles } value15.Normalize(); value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - int newDamage = (int)((double)projectile.damage * 0.2); - if (newDamage > 30) + int newDamage = (int)((double)projectile.damage * 0.25); + if (newDamage > 40) { - newDamage = 30; + newDamage = 40; } Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), value15.X, value15.Y, 569 + Main.rand.Next(3), newDamage, 0f, projectile.owner, 0f, 0f); } @@ -701,7 +548,7 @@ namespace CalamityMod.Projectiles num10 = num7 / num10; num8 *= num10; num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("AtaxiaOrb"), (int)((double)num * 1.5), 0f, projectile.owner, (float)num6, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("AtaxiaOrb"), (int)((double)num * 1.25), 0f, projectile.owner, (float)num6, 0f); if (target.canGhostHeal) { float num11 = 0.1f; //0.2 @@ -785,7 +632,7 @@ namespace CalamityMod.Projectiles num10 = num7 / num10; num8 *= num10; num9 *= num10; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocOrb"), (int)((double)num * 1.2), 0f, projectile.owner, (float)num6, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocOrb"), (int)((double)num * 1.25), 0f, projectile.owner, (float)num6, 0f); if (target.canGhostHeal) { float num11 = 0.1f; @@ -1116,6 +963,24 @@ namespace CalamityMod.Projectiles } #endregion + #region CanDamage + public override bool CanDamage(Projectile projectile) + { + switch (projectile.type) + { + case ProjectileID.Sharknado: + if (projectile.timeLeft > 440) + return false; + break; + case ProjectileID.Cthulunado: + if (projectile.timeLeft > 740) + return false; + break; + } + return true; + } + #endregion + #region Drawing public override Color? GetAlpha(Projectile projectile, Color lightColor) { @@ -1180,6 +1045,16 @@ namespace CalamityMod.Projectiles #region Kill public override void Kill(Projectile projectile, int timeLeft) { + if (Main.player[projectile.owner].GetModPlayer(mod).providenceLore && projectile.owner == Main.myPlayer && projectile.friendly && projectile.damage > 0 && + (projectile.melee || projectile.ranged || projectile.magic || rogue)) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + for (int i = 0; i < 3; i++) + { + int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default(Color), 1f); + Main.dust[dust].noGravity = true; + } + } if (projectile.ranged) { if (Main.player[projectile.owner].GetModPlayer(mod).tarraRanged && Main.rand.Next(0, 100) >= 88) diff --git a/Projectiles/Magic/AbyssBall.cs b/Projectiles/Magic/AbyssBall.cs index 61f19a5a4c..642addd4b0 100644 --- a/Projectiles/Magic/AbyssBall.cs +++ b/Projectiles/Magic/AbyssBall.cs @@ -60,7 +60,8 @@ namespace CalamityMod.Projectiles.Magic num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 173, 0f, 0f, 100, default(Color), 1f); Main.dust[num624].velocity *= 2f; } - } + projectile.Damage(); + } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { diff --git a/Projectiles/Magic/AetherBeam.cs b/Projectiles/Magic/AetherBeam.cs index 6d0cf6d9d5..c4a19fa227 100644 --- a/Projectiles/Magic/AetherBeam.cs +++ b/Projectiles/Magic/AetherBeam.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Magic { public class AetherBeam : ModProjectile { + private bool split = true; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -31,10 +33,15 @@ namespace CalamityMod.Projectiles.Magic { if (projectile.ai[0] == 1f) { - projectile.ai[0] = 0f; - projectile.timeLeft /= 2; - projectile.tileCollide = false; - } + projectile.magic = false; + projectile.ranged = true; + } + if (projectile.ai[1] == 1f) + { + split = false; + projectile.tileCollide = false; + projectile.ai[1] = 0f; + } projectile.damage += 5; if (projectile.alpha > 0) { @@ -61,7 +68,6 @@ namespace CalamityMod.Projectiles.Magic if (projectile.localAI[0] <= 0f) { projectile.Kill(); - return; } } } @@ -106,20 +112,23 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - float random = Main.rand.Next(30, 90); - float spread = random * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) + if (split) { - for (i = 0; i < 4; i++) + float random = Main.rand.Next(30, 90); + float spread = random * 0.0174f; + double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; + double deltaAngle = spread / 8f; + double offsetAngle; + int i; + if (projectile.owner == Main.myPlayer) { - 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 ), mod.ProjectileType("AetherBeam"), projectile.damage, projectile.knockBack, projectile.owner, 1f, 0f); - int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), mod.ProjectileType("AetherBeam"), projectile.damage, projectile.knockBack, projectile.owner, 1f, 0f); - } + for (i = 0; i < 4; i++) + { + 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), mod.ProjectileType("AetherBeam"), projectile.damage, projectile.knockBack, projectile.owner, projectile.ai[0], 1f); + int proj2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), mod.ProjectileType("AetherBeam"), projectile.damage, projectile.knockBack, projectile.owner, projectile.ai[0], 1f); + } + } } return true; } diff --git a/Projectiles/Magic/AstralStarMagic.cs b/Projectiles/Magic/AstralStarMagic.cs index cf60dbb72d..ff23e24c08 100644 --- a/Projectiles/Magic/AstralStarMagic.cs +++ b/Projectiles/Magic/AstralStarMagic.cs @@ -29,10 +29,6 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - if (projectile.ai[0] == 1f) - { - projectile.magic = true; - } int randomToSubtract = Main.rand.Next(1, 3); noTileHitCounter -= randomToSubtract; if (noTileHitCounter == 0) @@ -82,7 +78,6 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.Next(20) == 0) { Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - return; } } } diff --git a/Projectiles/Magic/Climax2.cs b/Projectiles/Magic/Climax2.cs new file mode 100644 index 0000000000..320a4a3069 --- /dev/null +++ b/Projectiles/Magic/Climax2.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class Climax2 : ModProjectile + { + private double timeElapsed = 0.0; + private double circleSize = 1.0; + private double circleGrowth = 0.02; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Climax"); + Main.projFrames[projectile.type] = 5; + } + + public override void SetDefaults() + { + projectile.width = 38; + projectile.height = 38; + projectile.friendly = true; + projectile.light = 0.5f; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 420; + projectile.magic = true; + } + + public override void AI() + { + timeElapsed += 0.02; + projectile.velocity.X = (float)(Math.Sin(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); + projectile.velocity.Y = (float)(Math.Cos(timeElapsed * (double)(0.5f * projectile.ai[0])) * circleSize); + circleSize += circleGrowth; + if (projectile.velocity.X > 0f) + { + projectile.rotation += (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; + } + else + { + projectile.rotation -= (Math.Abs(projectile.velocity.Y) + Math.Abs(projectile.velocity.X)) * 0.001f; + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frameCounter = 0; + projectile.frame++; + if (projectile.frame > 4) + { + projectile.frame = 0; + } + } + int num3; + for (int num433 = 0; num433 < 1000; num433 = num3 + 1) + { + num3 = num433; + } + int[] array = new int[20]; + int num434 = 0; + float num435 = 400f; + bool flag14 = false; + for (int num436 = 0; num436 < 200; num436 = num3 + 1) + { + if (Main.npc[num436].CanBeChasedBy(projectile, false)) + { + float num437 = Main.npc[num436].position.X + (float)(Main.npc[num436].width / 2); + float num438 = Main.npc[num436].position.Y + (float)(Main.npc[num436].height / 2); + float num439 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num437) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num438); + if (num439 < num435 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num436].Center, 1, 1)) + { + if (num434 < 20) + { + array[num434] = num436; + num434++; + } + flag14 = true; + } + } + num3 = num436; + } + if (projectile.timeLeft < 30) + { + flag14 = false; + } + if (flag14) + { + int num440 = Main.rand.Next(num434); + num440 = array[num440]; + float num441 = Main.npc[num440].position.X + (float)(Main.npc[num440].width / 2); + float num442 = Main.npc[num440].position.Y + (float)(Main.npc[num440].height / 2); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + projectile.localAI[0] = 0f; + float num443 = 8f; + Vector2 vector33 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + vector33 += projectile.velocity * 4f; + float num444 = num441 - vector33.X; + float num445 = num442 - vector33.Y; + float num446 = (float)Math.Sqrt((double)(num444 * num444 + num445 * num445)); + num446 = num443 / num446; + num444 *= num446; + num445 *= num446; + Projectile.NewProjectile(vector33.X, vector33.Y, num444, num445, mod.ProjectileType("ClimaxBeam"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + return; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 30) + { + float num7 = (float)projectile.timeLeft / 30f; + projectile.alpha = (int)(255f - 255f * num7); + } + return new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 0); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Magic/Climax2.png b/Projectiles/Magic/Climax2.png new file mode 100644 index 0000000000..09d7a242e3 Binary files /dev/null and b/Projectiles/Magic/Climax2.png differ diff --git a/Projectiles/Magic/CoralSpike.cs b/Projectiles/Magic/CoralSpike.cs index 15ef971cbb..23a2b22eb4 100644 --- a/Projectiles/Magic/CoralSpike.cs +++ b/Projectiles/Magic/CoralSpike.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 30; projectile.friendly = true; projectile.aiStyle = 14; - projectile.penetrate = -1; + projectile.penetrate = 4; projectile.timeLeft = 360; projectile.magic = true; } diff --git a/Projectiles/Magic/CryoBlast.cs b/Projectiles/Magic/CryoBlast.cs new file mode 100644 index 0000000000..b0c96befa0 --- /dev/null +++ b/Projectiles/Magic/CryoBlast.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class CryoBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 32; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 4; + projectile.timeLeft = 600; + } + + public override void AI() + { + if (projectile.scale <= 3.6f) + { + projectile.scale *= 1.01f; + projectile.width = (int)(16f * projectile.scale); + projectile.height = (int)(32f * projectile.scale); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0.5f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 4f) + { + for (int num468 = 0; num468 < 3; num468++) + { + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, 0f, 0f, 100, default(Color), projectile.scale); + Main.dust[num469].noGravity = true; + Main.dust[num469].velocity *= 0f; + int num470 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 185, 0f, 0f, 100, default(Color), projectile.scale); + Main.dust[num470].noGravity = true; + Main.dust[num470].velocity *= 0f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("GlacialState"), 360); + target.AddBuff(BuffID.Frostburn, 360); + } + } +} \ No newline at end of file diff --git a/Projectiles/Magic/CryoBlast.png b/Projectiles/Magic/CryoBlast.png new file mode 100644 index 0000000000..4a5f92eb8f Binary files /dev/null and b/Projectiles/Magic/CryoBlast.png differ diff --git a/Projectiles/Magic/HolyLaser.cs b/Projectiles/Magic/HolyLaser.cs index 804a532ad5..172dbd31ac 100644 --- a/Projectiles/Magic/HolyLaser.cs +++ b/Projectiles/Magic/HolyLaser.cs @@ -56,8 +56,9 @@ namespace CalamityMod.Projectiles.Magic { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMagic = true; + } } } } \ No newline at end of file diff --git a/Projectiles/Magic/MagnaBlast.cs b/Projectiles/Magic/MagnaBlast.cs index 283f91da5d..f3455e6859 100644 --- a/Projectiles/Magic/MagnaBlast.cs +++ b/Projectiles/Magic/MagnaBlast.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Magic { projectile.width = 16; projectile.height = 32; - projectile.scale = 0.9f; projectile.friendly = true; projectile.magic = true; projectile.penetrate = 1; @@ -28,10 +27,12 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - if (projectile.scale <= 2.2f) + if (projectile.scale <= 1.6f) { - projectile.scale *= 1.05f; - } + projectile.scale *= 1.01f; + projectile.width = (int)(16f * projectile.scale); + projectile.height = (int)(32f * projectile.scale); + } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 1f) / 255f); projectile.localAI[0] += 1f; @@ -39,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic { for (int num468 = 0; num468 < 3; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 59, 0f, 0f, 100, default(Color), 2f); + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 59, 0f, 0f, 100, default(Color), projectile.scale); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } diff --git a/Projectiles/Magic/MagnusBeam.cs b/Projectiles/Magic/MagnusBeam.cs new file mode 100644 index 0000000000..b686c02372 --- /dev/null +++ b/Projectiles/Magic/MagnusBeam.cs @@ -0,0 +1,290 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class MagnusBeam : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Beam"); + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 2; + projectile.alpha = 255; + } + + public override void AI() + { + float num29 = 5f; + float num30 = 150f; + float scaleFactor = 6f; + Vector2 value7 = new Vector2(10f, 20f); + float num31 = 1f; + int num32 = 3 * projectile.MaxUpdates; + int num33 = Utils.SelectRandom(Main.rand, new int[] + { + 56, + 92, + 229, + 206, + 181 + }); + int num34 = 261; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + projectile.localAI[0] = (float)(-(float)Main.rand.Next(48)); + } + else if (projectile.ai[1] == 1f && projectile.owner == Main.myPlayer) + { + int num35 = -1; + float num36 = num30; + for (int num37 = 0; num37 < 200; num37++) + { + if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(projectile, false)) + { + Vector2 center3 = Main.npc[num37].Center; + float num38 = Vector2.Distance(center3, projectile.Center); + if (num38 < num36 && num35 == -1 && Collision.CanHitLine(projectile.Center, 1, 1, center3, 1, 1)) + { + num36 = num38; + num35 = num37; + } + } + } + if (num36 < 8f) + { + projectile.Kill(); + return; + } + if (num35 != -1) + { + projectile.ai[1] = num29 + 1f; + projectile.ai[0] = (float)num35; + projectile.netUpdate = true; + } + } + else if (projectile.ai[1] > num29) + { + projectile.ai[1] += 1f; + int num39 = (int)projectile.ai[0]; + if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(projectile, false)) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + else + { + projectile.velocity.ToRotation(); + Vector2 vector6 = Main.npc[num39].Center - projectile.Center; + if (vector6.Length() < 20f) + { + projectile.Kill(); + return; + } + if (vector6 != Vector2.Zero) + { + vector6.Normalize(); + vector6 *= scaleFactor; + } + float num40 = 30f; + projectile.velocity = (projectile.velocity * (num40 - 1f) + vector6) / num40; + } + } + if (projectile.ai[1] >= 1f && projectile.ai[1] < num29) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] == num29) + { + projectile.ai[1] = 1f; + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 48f) + { + projectile.localAI[0] = 0f; + } + else if (projectile.alpha == 0) + { + for (int num41 = 0; num41 < 2; num41++) + { + Vector2 value8 = Vector2.UnitX * -30f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default(Vector2)) * value7 - projectile.rotation.ToRotationVector2() * 10f; + int num42 = Dust.NewDust(projectile.Center, 0, 0, num34, 0f, 0f, 160, default(Color), 1f); + Main.dust[num42].scale = num31; + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8 + projectile.velocity * 2f; + Main.dust[num42].velocity = Vector2.Normalize(projectile.Center + projectile.velocity * 2f * 8f - Main.dust[num42].position) * 2f + projectile.velocity * 2f; + } + } + if (Main.rand.Next(12) == 0) + { + for (int num43 = 0; num43 < 1; num43++) + { + Vector2 value9 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); + int num44 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, 0f, 0f, 100, default(Color), 1f); + Main.dust[num44].velocity *= 0.1f; + Main.dust[num44].position = projectile.Center + value9 * (float)projectile.width / 2f + projectile.velocity * 2f; + Main.dust[num44].fadeIn = 0.9f; + } + } + if (Main.rand.Next(64) == 0) + { + for (int num45 = 0; num45 < 1; num45++) + { + Vector2 value10 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); + int num46 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 234, 0f, 0f, 155, default(Color), 0.8f); + Main.dust[num46].velocity *= 0.3f; + Main.dust[num46].position = projectile.Center + value10 * (float)projectile.width / 2f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num46].fadeIn = 1.4f; + } + } + } + if (Main.rand.Next(4) == 0) + { + for (int num47 = 0; num47 < 2; num47++) + { + Vector2 value11 = -Vector2.UnitX.RotatedByRandom(0.78539818525314331).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); + int num48 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num33, 0f, 0f, 0, default(Color), 1.2f); + Main.dust[num48].velocity *= 0.3f; + Main.dust[num48].noGravity = true; + Main.dust[num48].position = projectile.Center + value11 * (float)projectile.width / 2f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num48].fadeIn = 1.4f; + } + } + } + if (Main.rand.Next(3) == 0) + { + Vector2 value13 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); + int num50 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num34, 0f, 0f, 100, default(Color), 1f); + Main.dust[num50].velocity *= 0.3f; + Main.dust[num50].position = projectile.Center + value13 * (float)projectile.width / 2f; + Main.dust[num50].fadeIn = 1.2f; + Main.dust[num50].scale = 1.5f; + Main.dust[num50].noGravity = true; + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); + for (int num151 = 0; num151 < 3; num151++) + { + int num154 = 14; + int num155 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num154 * 2, projectile.height - num154 * 2, 263, 0f, 0f, 100, default(Color), 1.35f); + Main.dust[num155].noGravity = true; + Main.dust[num155].velocity *= 0.1f; + Main.dust[num155].velocity += projectile.velocity * 0.5f; + } + if (Main.rand.Next(8) == 0) + { + int num156 = 16; + int num157 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width - num156 * 2, projectile.height - num156 * 2, 263, 0f, 0f, 100, default(Color), 1f); + Main.dust[num157].velocity *= 0.25f; + Main.dust[num157].noGravity = true; + Main.dust[num157].velocity += projectile.velocity * 0.5f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + Player player = Main.player[projectile.owner]; + player.statLife += 1; + player.statMana += 25; + player.HealEffect(1); + player.ManaEffect(25); + } + + public override void Kill(int timeLeft) + { + int num47 = Utils.SelectRandom(Main.rand, new int[] + { + 56, + 92, + 229, + 206, + 181 + }); + int num48 = 263; + int num49 = 263; + int height = 50; + float num50 = 1.7f; + float num51 = 0.8f; + float num52 = 2f; + Vector2 value3 = (projectile.rotation - 1.57079637f).ToRotationVector2(); + Vector2 value4 = value3 * projectile.velocity.Length() * (float)projectile.MaxUpdates; + Main.PlaySound(SoundID.Item14, projectile.position); + projectile.position = projectile.Center; + projectile.width = (projectile.height = height); + projectile.Center = projectile.position; + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.Damage(); + int num3; + for (int num53 = 0; num53 < 40; num53 = num3 + 1) + { + num47 = Utils.SelectRandom(Main.rand, new int[] + { + 56, + 92, + 229, + 206, + 181 + }); + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num47, 0f, 0f, 200, default(Color), num50); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + Main.dust[num54].noGravity = true; + Dust dust = Main.dust[num54]; + dust.velocity *= 3f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num48, 0f, 0f, 100, default(Color), num51); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)projectile.width / 2f; + dust = Main.dust[num54]; + dust.velocity *= 2f; + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Crimson * 0.5f; + dust = Main.dust[num54]; + dust.velocity += value4 * Main.rand.NextFloat(); + num3 = num53; + } + for (int num55 = 0; num55 < 20; num55 = num3 + 1) + { + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num49, 0f, 0f, 0, default(Color), num52); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)) * (float)projectile.width / 3f; + Main.dust[num56].noGravity = true; + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + dust.velocity += value4 * (0.6f + 0.6f * Main.rand.NextFloat()); + num3 = num55; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Magic/MagnusBeam.png b/Projectiles/Magic/MagnusBeam.png new file mode 100644 index 0000000000..0056fc1e24 Binary files /dev/null and b/Projectiles/Magic/MagnusBeam.png differ diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index ed8185fdc5..fe44a0f7bd 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - projectile.damage = (int)((double)projectile.damage * 1.25f); + projectile.damage = (int)((double)projectile.damage * 1.25); projectile.penetrate--; if (projectile.penetrate <= 0) { @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Magic { return; } - projectile.damage = (int)((double)projectile.damage * 1.1f); + projectile.damage = (int)((double)projectile.damage * 1.1); } public override void AI() diff --git a/Projectiles/Magic/SolarBeam2.cs b/Projectiles/Magic/SolarBeam2.cs index adc62fac4e..2fb8a01650 100644 --- a/Projectiles/Magic/SolarBeam2.cs +++ b/Projectiles/Magic/SolarBeam2.cs @@ -70,8 +70,9 @@ namespace CalamityMod.Projectiles.Magic target.immune[projectile.owner] = 4; if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMagic = true; + } } } } \ No newline at end of file diff --git a/Projectiles/Magic/SpiritFlameCurse.cs b/Projectiles/Magic/SpiritFlameCurse.cs index 91c6bdf7a6..8875f39554 100644 --- a/Projectiles/Magic/SpiritFlameCurse.cs +++ b/Projectiles/Magic/SpiritFlameCurse.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Magic public override void SetStaticDefaults() { DisplayName.SetDefault("Flame"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 8; } public override void SetDefaults() @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (projectile.frame > 7) { projectile.frame = 0; } @@ -74,6 +74,7 @@ namespace CalamityMod.Projectiles.Magic num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 160, 0f, 0f, 100, default(Color), 2f); Main.dust[num624].velocity *= 2f; } + projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Magic/SpiritFlameCurse.png b/Projectiles/Magic/SpiritFlameCurse.png index b622eda5c0..732df00855 100644 Binary files a/Projectiles/Magic/SpiritFlameCurse.png and b/Projectiles/Magic/SpiritFlameCurse.png differ diff --git a/Projectiles/Magic/StarfleetMK2.png b/Projectiles/Magic/StarfleetMK2.png deleted file mode 100644 index f6a9035595..0000000000 Binary files a/Projectiles/Magic/StarfleetMK2.png and /dev/null differ diff --git a/Projectiles/Magic/ThunderstormShot.cs b/Projectiles/Magic/ThunderstormShot.cs new file mode 100644 index 0000000000..e05316cefb --- /dev/null +++ b/Projectiles/Magic/ThunderstormShot.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ThunderstormShot : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shot"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.extraUpdates = 25; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 9f) + { + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f)]; + dust.velocity = Vector2.Zero; + dust.position -= projectile.velocity / 5f * (float)num121; + dust.noGravity = true; + dust.noLight = true; + Dust dust2 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 1f)]; + dust2.velocity = Vector2.Zero; + dust2.position -= projectile.velocity / 5f * (float)num121; + dust2.noGravity = true; + dust2.noLight = true; + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); + for (int n = 0; n < 5; n++) + { + float x = projectile.position.X + (float)Main.rand.Next(-200, 200); + float y = projectile.position.Y - 1500f; + Vector2 vector = new Vector2(x, y); + float num13 = projectile.position.X + (float)(projectile.width / 2) - vector.X; + float num14 = projectile.position.Y + (float)(projectile.height / 2) - vector.Y; + num13 += (float)Main.rand.Next(-100, 101); + int num15 = 29; + float num16 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); + num16 = (float)num15 / num16; + num13 *= num16; + num14 *= num16; + Projectile.NewProjectile(x, y, num13, num14, mod.ProjectileType("ThunderstormShotSplit"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + projectile.position = projectile.Center; + projectile.width = (projectile.height = 36); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 1f; //0.75 + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 229, vector7.X, vector7.Y, 100, default(Color), 1.2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X, vector7.Y, 100, default(Color), 1.2f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } + } +} \ No newline at end of file diff --git a/Projectiles/Magic/ThunderstormShot.png b/Projectiles/Magic/ThunderstormShot.png new file mode 100644 index 0000000000..a3192f9461 Binary files /dev/null and b/Projectiles/Magic/ThunderstormShot.png differ diff --git a/Projectiles/Magic/ThunderstormShotSplit.cs b/Projectiles/Magic/ThunderstormShotSplit.cs new file mode 100644 index 0000000000..6b57c14467 --- /dev/null +++ b/Projectiles/Magic/ThunderstormShotSplit.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class ThunderstormShotSplit : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shot"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.friendly = true; + projectile.magic = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 600; + projectile.extraUpdates = 15; + } + + public override void AI() + { + if (projectile.timeLeft < 420) + { + projectile.tileCollide = true; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 6f) + { + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 107, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 0.5f)]; + dust.velocity = Vector2.Zero; + dust.position -= projectile.velocity / 5f * (float)num121; + dust.noGravity = true; + dust.noLight = true; + Dust dust2 = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 229, projectile.velocity.X, projectile.velocity.Y, 100, default(Color), 0.5f)]; + dust2.velocity = Vector2.Zero; + dust2.position -= projectile.velocity / 5f * (float)num121; + dust2.noGravity = true; + dust2.noLight = true; + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 125); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 16); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; //0.75 + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 229, vector7.X, vector7.Y, 100, default(Color), 0.6f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.5f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X, vector7.Y, 100, default(Color), 0.6f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } + } +} \ No newline at end of file diff --git a/Projectiles/Magic/ThunderstormShotSplit.png b/Projectiles/Magic/ThunderstormShotSplit.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Magic/ThunderstormShotSplit.png differ diff --git a/Projectiles/Magic/Vehemence.cs b/Projectiles/Magic/Vehemence.cs index 040966af11..ded8898dad 100644 --- a/Projectiles/Magic/Vehemence.cs +++ b/Projectiles/Magic/Vehemence.cs @@ -56,9 +56,9 @@ namespace CalamityMod.Projectiles.Magic double lifeMax = (double)target.lifeMax; double damageMult = (lifeAmount / lifeMax) * 7; damage = (int)Math.Pow(damage, damageMult); - if (damage > 500000) + if (damage > 1000000) { - damage = 500000; + damage = 1000000; } } diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index 5b85e6d9b0..fdd214bcfb 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 174, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); Projectile.NewProjectile(projectile.position.X, projectile.position.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, mod.ProjectileType("TinyFlare"), - (int)((double)projectile.damage * 0.7f), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + (int)((double)projectile.damage * 0.7), projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); } } Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index 5bcc4a7f52..e32ee23a39 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Melee projectile.height = 4; projectile.friendly = true; projectile.melee = true; - projectile.penetrate = 1; - projectile.timeLeft = 200; + projectile.penetrate = 2; + projectile.timeLeft = 180; } public override void AI() diff --git a/Projectiles/Melee/CosmicDischarge.cs b/Projectiles/Melee/CosmicDischarge.cs index 4ff3661828..d9eb67b2ee 100644 --- a/Projectiles/Melee/CosmicDischarge.cs +++ b/Projectiles/Melee/CosmicDischarge.cs @@ -29,7 +29,8 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 4; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs new file mode 100644 index 0000000000..3ebbcfbf7f --- /dev/null +++ b/Projectiles/Melee/Cyclone.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Cyclone : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cyclone"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 40; + projectile.height = 40; + projectile.alpha = 255; + projectile.friendly = true; + projectile.melee = true; + projectile.timeLeft = 300; + projectile.extraUpdates = 2; + projectile.penetrate = 2; + projectile.ignoreWater = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + projectile.rotation += 2.5f; + projectile.alpha -= 5; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float npcCenterX = 0f; + float npcCenterY = 0f; + float num474 = 600f; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1) && !Main.npc[num475].boss) + { + npcCenterX = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2); + npcCenterY = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2); + float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - npcCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - npcCenterY); + if (num478 < num474) + { + if (Main.npc[num475].position.X < num472) + { + Main.npc[num475].velocity.X += 0.05f; + } + else + { + Main.npc[num475].velocity.X -= 0.05f; + } + if (Main.npc[num475].position.Y < num473) + { + Main.npc[num475].velocity.Y += 0.05f; + } + else + { + Main.npc[num475].velocity.Y -= 0.05f; + } + } + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(204, 255, 255, projectile.alpha); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Melee/Cyclone.png b/Projectiles/Melee/Cyclone.png new file mode 100644 index 0000000000..c97d6cde91 Binary files /dev/null and b/Projectiles/Melee/Cyclone.png differ diff --git a/Projectiles/Melee/DepthOrb.cs b/Projectiles/Melee/DepthOrb.cs index 6a16694033..f6ee53c7b9 100644 --- a/Projectiles/Melee/DepthOrb.cs +++ b/Projectiles/Melee/DepthOrb.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee projectile.height = 12; projectile.friendly = true; projectile.ignoreWater = true; - projectile.timeLeft = 300; + projectile.timeLeft = 30; projectile.penetrate = 1; projectile.melee = true; } @@ -35,13 +35,16 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; } - return; } public override void Kill(int timeLeft) { Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); - for (int dust = 0; dust <= 30; dust++) + projectile.position = projectile.Center; + projectile.width = (projectile.height = 60); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int dust = 0; dust < 30; dust++) { float num463 = (float)Main.rand.Next(-10, 11); float num464 = (float)Main.rand.Next(-10, 11); @@ -61,6 +64,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; } + projectile.Damage(); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/EradicatorMeleeProjectile.cs b/Projectiles/Melee/EradicatorMeleeProjectile.cs index eb23a04586..dec0155a5e 100644 --- a/Projectiles/Melee/EradicatorMeleeProjectile.cs +++ b/Projectiles/Melee/EradicatorMeleeProjectile.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; + projectile.width = 58; + projectile.height = 58; projectile.friendly = true; projectile.melee = true; projectile.tileCollide = false; @@ -78,8 +78,9 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 1f, 0f); - } + int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } } } } diff --git a/Projectiles/Melee/Exobeam.cs b/Projectiles/Melee/Exobeam.cs index 1c30e6f8ce..32995a1700 100644 --- a/Projectiles/Melee/Exobeam.cs +++ b/Projectiles/Melee/Exobeam.cs @@ -130,7 +130,6 @@ namespace CalamityMod.Projectiles.Melee } } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - return; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/FlameScytheProjectileMelee.cs b/Projectiles/Melee/FlameScytheProjectileMelee.cs index ae16bfd1ea..c6d6f2d770 100644 --- a/Projectiles/Melee/FlameScytheProjectileMelee.cs +++ b/Projectiles/Melee/FlameScytheProjectileMelee.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; + projectile.width = 34; + projectile.height = 34; projectile.friendly = true; projectile.melee = true; projectile.penetrate = -1; diff --git a/Projectiles/Melee/Galaxia.cs b/Projectiles/Melee/Galaxia.cs index 68e86c4974..f9b21cf186 100644 --- a/Projectiles/Melee/Galaxia.cs +++ b/Projectiles/Melee/Galaxia.cs @@ -76,7 +76,6 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.Next(10) == 0) { Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - return; } } float num472 = projectile.Center.X; @@ -111,9 +110,7 @@ namespace CalamityMod.Projectiles.Melee num485 *= num486; projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; } - return; } public override Color? GetAlpha(Color lightColor) @@ -157,8 +154,9 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(mod.BuffType("Plague"), 1200); player.AddBuff(BuffID.Thorns, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (snow) { target.AddBuff(mod.BuffType("GlacialState"), 1200); @@ -169,61 +167,71 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(mod.BuffType("CrushDepth"), 1200); player.AddBuff(BuffID.Wet, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 405, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 405, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (corrupt) { player.AddBuff(BuffID.Wrath, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 95, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; + Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].penetrate = 1; } else if (crimson) { player.AddBuff(BuffID.Rage, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 280, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; + Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].penetrate = 1; } else if (dungeon) { target.AddBuff(BuffID.Frostburn, 1200); player.AddBuff(BuffID.Dangersense, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 27, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; + Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].penetrate = 1; } else if (desert) { target.AddBuff(mod.BuffType("HolyLight"), 1200); player.AddBuff(BuffID.Endurance, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (glow) { target.AddBuff(mod.BuffType("TemporalSadness"), 1200); player.AddBuff(BuffID.Spelunker, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (hell) { target.AddBuff(mod.BuffType("BrimstoneFlames"), 1200); player.AddBuff(BuffID.Inferno, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (holy) { target.AddBuff(mod.BuffType("HolyLight"), 1200); player.AddBuff(BuffID.Heartreach, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (nebula) { player.AddBuff(BuffID.MagicPower, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (stardust) { player.AddBuff(BuffID.Summoning, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 614, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; + Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].penetrate = 1; } else if (solar) { @@ -233,8 +241,9 @@ namespace CalamityMod.Projectiles.Melee else if (vortex) { player.AddBuff(BuffID.AmmoReservation, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else { target.AddBuff(mod.BuffType("ArmorCrunch"), 1200); diff --git a/Projectiles/Melee/Galaxia2.cs b/Projectiles/Melee/Galaxia2.cs index 936e9ae897..a5d49794b6 100644 --- a/Projectiles/Melee/Galaxia2.cs +++ b/Projectiles/Melee/Galaxia2.cs @@ -75,7 +75,6 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.Next(10) == 0) { Gore.NewGore(projectile.position, new Vector2(projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); - return; } } float num472 = projectile.Center.X; @@ -110,9 +109,7 @@ namespace CalamityMod.Projectiles.Melee num485 *= num486; projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; } - return; } public override Color? GetAlpha(Color lightColor) @@ -156,8 +153,9 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(mod.BuffType("Plague"), 1200); player.AddBuff(BuffID.Thorns, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 206, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (snow) { target.AddBuff(mod.BuffType("GlacialState"), 1200); @@ -168,61 +166,71 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(mod.BuffType("CrushDepth"), 1200); player.AddBuff(BuffID.Wet, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 405, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 405, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (corrupt) { player.AddBuff(BuffID.Wrath, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 95, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; + Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].penetrate = 1; } else if (crimson) { player.AddBuff(BuffID.Rage, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 280, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; + Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].penetrate = 1; } else if (dungeon) { target.AddBuff(BuffID.Frostburn, 1200); player.AddBuff(BuffID.Dangersense, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 27, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; + Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].penetrate = 1; } else if (desert) { target.AddBuff(mod.BuffType("HolyLight"), 1200); player.AddBuff(BuffID.Endurance, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 661, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (glow) { target.AddBuff(mod.BuffType("TemporalSadness"), 1200); player.AddBuff(BuffID.Spelunker, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 131, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (hell) { target.AddBuff(mod.BuffType("BrimstoneFlames"), 1200); player.AddBuff(BuffID.Inferno, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 15, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (holy) { target.AddBuff(mod.BuffType("HolyLight"), 1200); player.AddBuff(BuffID.Heartreach, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 644, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (nebula) { player.AddBuff(BuffID.MagicPower, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 634, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else if (stardust) { player.AddBuff(BuffID.Summoning, 600); int ball = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 614, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - Main.projectile[ball].penetrate = 1; + Main.projectile[ball].GetGlobalProjectile(mod).forceMelee = true; + Main.projectile[ball].penetrate = 1; } else if (solar) { @@ -232,8 +240,9 @@ namespace CalamityMod.Projectiles.Melee else if (vortex) { player.AddBuff(BuffID.AmmoReservation, 600); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y, 616, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } else { target.AddBuff(mod.BuffType("ArmorCrunch"), 1200); diff --git a/Projectiles/Melee/IceBombFriendly.cs b/Projectiles/Melee/IceBombFriendly.cs index 2e0725042e..b58d5b53ef 100644 --- a/Projectiles/Melee/IceBombFriendly.cs +++ b/Projectiles/Melee/IceBombFriendly.cs @@ -49,12 +49,10 @@ namespace CalamityMod.Projectiles.Melee { offsetAngle = (startAngle + deltaAngle * ( i + i * i ) / 2f ) + 32f * i; int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( Math.Sin(offsetAngle) * 5f ), (float)( Math.Cos(offsetAngle) * 5f ), 349, 30, 2f, projectile.owner, 0f, 0f); - Main.projectile[projectile1].hostile = false; - Main.projectile[projectile1].friendly = true; - int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), 349, 30, 2f, projectile.owner, 0f, 0f); - Main.projectile[projectile2].hostile = false; - Main.projectile[projectile2].friendly = true; - } + Main.projectile[projectile1].GetGlobalProjectile(mod).forceMelee = true; + int projectile2 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)( -Math.Sin(offsetAngle) * 5f ), (float)( -Math.Cos(offsetAngle) * 5f ), 349, 30, 2f, projectile.owner, 0f, 0f); + Main.projectile[projectile2].GetGlobalProjectile(mod).forceMelee = true; + } } for (int k = 0; k < 3; k++) { diff --git a/Projectiles/Melee/Iceberg.cs b/Projectiles/Melee/Iceberg.cs index 8798f5f686..17103998c5 100644 --- a/Projectiles/Melee/Iceberg.cs +++ b/Projectiles/Melee/Iceberg.cs @@ -7,51 +7,62 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class Iceberg : ModProjectile - { - public override void SetStaticDefaults() + public class Iceberg : ModProjectile + { + public override void SetStaticDefaults() { DisplayName.SetDefault("Iceberg"); } - - public override void SetDefaults() - { - projectile.width = 20; - projectile.height = 20; - projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = 2; - projectile.aiStyle = 1; - aiType = 1; - } - - public override void AI() - { - projectile.localAI[0] += 1f; + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.localAI[0] += 1f; if (projectile.localAI[0] > 4f) { for (int num468 = 0; num468 < 3; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default(Color), 2f); + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 67, 0f, 0f, 100, default(Color), 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } } - } - - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Frostburn, 300); - target.AddBuff(mod.BuffType("GlacialState"), 60); - } - } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + double newDamageMult = 1.0 - ((double)projectile.timeLeft / 300.0); + damage = (int)((double)damage * newDamageMult); + knockback = 0f; + if (crit || target.buffImmune[mod.BuffType("GlacialState")]) + damage *= 2; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + int debuffDuration = 300 - projectile.timeLeft; + if (projectile.timeLeft < 270) + { + target.AddBuff(mod.BuffType("GlacialState"), debuffDuration); + } + } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Icebreaker.cs b/Projectiles/Melee/Icebreaker.cs index 99585a51e1..971f926d63 100644 --- a/Projectiles/Melee/Icebreaker.cs +++ b/Projectiles/Melee/Icebreaker.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Melee projectile.width = 30; projectile.height = 30; projectile.friendly = true; - projectile.melee = true; - projectile.penetrate = -1; + projectile.GetGlobalProjectile(mod).rogue = true; + projectile.penetrate = -1; projectile.aiStyle = 3; projectile.timeLeft = 120; aiType = 52; diff --git a/Projectiles/Melee/LaserFountain.cs b/Projectiles/Melee/LaserFountain.cs index 09d87a692e..1e26adbc46 100644 --- a/Projectiles/Melee/LaserFountain.cs +++ b/Projectiles/Melee/LaserFountain.cs @@ -35,7 +35,8 @@ namespace CalamityMod.Projectiles.Melee { if (projectile.owner == Main.myPlayer) { - int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, mod.ProjectileType("NebulaShot"), 350, projectile.knockBack, projectile.owner, 1f, 0f); + int projectile1 = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, mod.ProjectileType("NebulaShot"), (int)(350f * Main.player[projectile.owner].meleeDamage), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[projectile1].GetGlobalProjectile(mod).forceMelee = true; Main.projectile[projectile1].aiStyle = 1; } projectile.localAI[0] = 0f; diff --git a/Projectiles/Melee/Leech.cs b/Projectiles/Melee/Leech.cs index b0b74db782..e2fb86b43b 100644 --- a/Projectiles/Melee/Leech.cs +++ b/Projectiles/Melee/Leech.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Melee projectile.width = 4; projectile.height = 4; projectile.friendly = true; - projectile.penetrate = 1; - projectile.timeLeft = 200; + projectile.penetrate = 2; + projectile.timeLeft = 180; projectile.melee = true; } diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index 3e9ab54eff..6fcac0dba0 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 6; - projectile.height = 6; + projectile.width = 12; + projectile.height = 12; projectile.friendly = true; projectile.ignoreWater = true; projectile.melee = true; diff --git a/Projectiles/Melee/MirrorBlast.png b/Projectiles/Melee/MirrorBlast.png index b9497e1bad..b2dba2923c 100644 Binary files a/Projectiles/Melee/MirrorBlast.png and b/Projectiles/Melee/MirrorBlast.png differ diff --git a/Projectiles/Melee/Mourningstar.cs b/Projectiles/Melee/Mourningstar.cs index 2c98bed22a..6a8e7047a8 100644 --- a/Projectiles/Melee/Mourningstar.cs +++ b/Projectiles/Melee/Mourningstar.cs @@ -29,7 +29,8 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 4; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/Murasama.cs b/Projectiles/Melee/Murasama.cs index 99c4cc2c8f..0fe0cd096f 100644 --- a/Projectiles/Melee/Murasama.cs +++ b/Projectiles/Melee/Murasama.cs @@ -27,7 +27,8 @@ namespace CalamityMod.Projectiles.Melee projectile.ownerHitCheck = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 0; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/Nebulash.cs b/Projectiles/Melee/Nebulash.cs index 6e56a3c052..3a932572a1 100644 --- a/Projectiles/Melee/Nebulash.cs +++ b/Projectiles/Melee/Nebulash.cs @@ -29,7 +29,8 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 2; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/OPHammerMelee.cs b/Projectiles/Melee/OPHammerMelee.cs index 023da31cf8..d959013292 100644 --- a/Projectiles/Melee/OPHammerMelee.cs +++ b/Projectiles/Melee/OPHammerMelee.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - projectile.width = 38; - projectile.height = 38; + projectile.width = 62; + projectile.height = 62; projectile.friendly = true; projectile.melee = true; projectile.tileCollide = false; diff --git a/Projectiles/Melee/RoyalKnifeMelee.png b/Projectiles/Melee/RoyalKnifeMelee.png index 0ee108a711..d8793dd624 100644 Binary files a/Projectiles/Melee/RoyalKnifeMelee.png and b/Projectiles/Melee/RoyalKnifeMelee.png differ diff --git a/Projectiles/Melee/Spears/AstralPike.cs b/Projectiles/Melee/Spears/AstralPike.cs index 582910c3f7..609127b400 100644 --- a/Projectiles/Melee/Spears/AstralPike.cs +++ b/Projectiles/Melee/Spears/AstralPike.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/Spears/Brimlance.cs b/Projectiles/Melee/Spears/Brimlance.cs index 87f0fffc8c..dd3941d892 100644 --- a/Projectiles/Melee/Spears/Brimlance.cs +++ b/Projectiles/Melee/Spears/Brimlance.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/Spears/DiseasedPike.cs b/Projectiles/Melee/Spears/DiseasedPike.cs index a54f783ee2..8612059ea3 100644 --- a/Projectiles/Melee/Spears/DiseasedPike.cs +++ b/Projectiles/Melee/Spears/DiseasedPike.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/Spears/EarthenPike.cs b/Projectiles/Melee/Spears/EarthenPike.cs index 163c2ea60f..9cf6c1a0ae 100644 --- a/Projectiles/Melee/Spears/EarthenPike.cs +++ b/Projectiles/Melee/Spears/EarthenPike.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs index f79266decc..1445eb945f 100644 --- a/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs +++ b/Projectiles/Melee/Spears/ExsanguinationLanceProjectile.cs @@ -7,15 +7,15 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { - public class ExsanguinationLanceProjectile : ModProjectile - { - public override void SetStaticDefaults() + public class ExsanguinationLanceProjectile : ModProjectile + { + public override void SetStaticDefaults() { DisplayName.SetDefault("Lance"); } - - public override void SetDefaults() - { + + public override void SetDefaults() + { projectile.width = 95; //The width of the .png file in pixels divided by 2. projectile.aiStyle = 19; projectile.melee = true; //Dictates whether this is a melee-class weapon. @@ -28,52 +28,53 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if(projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if(Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) { projectile.localAI[0] = 1f; } - } - else - { - projectile.ai[0] += 0.95f; - } - if(Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if(projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 6; + } + else + { + projectile.ai[0] += 0.95f; + } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 6; target.AddBuff(BuffID.OnFire, 300); } - } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Spears/FulgurationHalberd.cs b/Projectiles/Melee/Spears/FulgurationHalberd.cs new file mode 100644 index 0000000000..cd99dfe8d4 --- /dev/null +++ b/Projectiles/Melee/Spears/FulgurationHalberd.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee.Spears +{ + public class FulgurationHalberd : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Fulguration Halberd"); + } + + public override void SetDefaults() + { + projectile.width = 40; //The width of the .png file in pixels divided by 2. + projectile.aiStyle = 19; + projectile.melee = true; //Dictates whether projectile is a melee-class weapon. + projectile.timeLeft = 90; + projectile.height = 40; //The height of the .png file in pixels divided by 2. + projectile.friendly = true; + projectile.hostile = false; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.ownerHitCheck = true; + projectile.hide = true; + } + + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; + } + else + { + projectile.ai[0] += 0.95f; + } + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; + target.AddBuff(mod.BuffType("BurningBlood"), 300); + } + } +} \ No newline at end of file diff --git a/Projectiles/Melee/Spears/FulgurationHalberd.png b/Projectiles/Melee/Spears/FulgurationHalberd.png new file mode 100644 index 0000000000..551b268497 Binary files /dev/null and b/Projectiles/Melee/Spears/FulgurationHalberd.png differ diff --git a/Projectiles/Melee/Spears/GildedProboscis.cs b/Projectiles/Melee/Spears/GildedProboscis.cs index e7dff2a88f..730f975567 100644 --- a/Projectiles/Melee/Spears/GildedProboscis.cs +++ b/Projectiles/Melee/Spears/GildedProboscis.cs @@ -30,7 +30,8 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.hide = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 1; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { @@ -75,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type == NPCID.TargetDummy) + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) { return; } diff --git a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs index e7f61e6fcc..cf5c008b28 100644 --- a/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs +++ b/Projectiles/Melee/Spears/GoldplumeSpearProjectile.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/Spears/HeartRapierProjectile.cs b/Projectiles/Melee/Spears/HeartRapierProjectile.cs index 7373e671be..9ef586cbde 100644 --- a/Projectiles/Melee/Spears/HeartRapierProjectile.cs +++ b/Projectiles/Melee/Spears/HeartRapierProjectile.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs index c629fa05ca..4209eba86e 100644 --- a/Projectiles/Melee/Spears/MarniteSpearProjectile.cs +++ b/Projectiles/Melee/Spears/MarniteSpearProjectile.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/Spears/SausageMaker.cs b/Projectiles/Melee/Spears/SausageMaker.cs index 4ee298fce7..e872d67f5a 100644 --- a/Projectiles/Melee/Spears/SausageMaker.cs +++ b/Projectiles/Melee/Spears/SausageMaker.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs index 5a3d5d4a55..ff73b42bb0 100644 --- a/Projectiles/Melee/Spears/StarnightLanceProjectile.cs +++ b/Projectiles/Melee/Spears/StarnightLanceProjectile.cs @@ -7,15 +7,15 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Spears { - public class StarnightLanceProjectile : ModProjectile - { - public override void SetStaticDefaults() + public class StarnightLanceProjectile : ModProjectile + { + public override void SetStaticDefaults() { DisplayName.SetDefault("Lance"); } - - public override void SetDefaults() - { + + public override void SetDefaults() + { projectile.width = 40; //The width of the .png file in pixels divided by 2. projectile.aiStyle = 19; projectile.melee = true; //Dictates whether projectile is a melee-class weapon. @@ -28,55 +28,55 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - } + } - public override void AI() - { - Main.player[projectile.owner].direction = projectile.direction; - Main.player[projectile.owner].heldProj = projectile.whoAmI; - Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; - projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); - projectile.position += projectile.velocity * projectile.ai[0]; - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 29, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if(projectile.ai[0] == 0f) - { - projectile.ai[0] = 3f; - projectile.netUpdate = true; - } - if(Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) - { - projectile.ai[0] -= 2.4f; + public override void AI() + { + Main.player[projectile.owner].direction = projectile.direction; + Main.player[projectile.owner].heldProj = projectile.whoAmI; + Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation; + projectile.position.X = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - (float)(projectile.height / 2); + projectile.position += projectile.velocity * projectile.ai[0]; + if (Main.rand.Next(5) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 29, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.ai[0] == 0f) + { + projectile.ai[0] = 3f; + projectile.netUpdate = true; + } + if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3) + { + projectile.ai[0] -= 2.4f; if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) { projectile.localAI[0] = 1f; Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X * projectile.ai[0], projectile.Center.Y + projectile.velocity.Y * projectile.ai[0], projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, mod.ProjectileType("StarnightBeam"), (int)((double)projectile.damage * 0.8), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f); } - } - else - { - projectile.ai[0] += 0.95f; - } - - if(Main.player[projectile.owner].itemAnimation == 0) - { - projectile.Kill(); - } - - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if(projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 8; + } + else + { + projectile.ai[0] += 0.95f; + } + + if (Main.player[projectile.owner].itemAnimation == 0) + { + projectile.Kill(); + } + + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.immune[projectile.owner] = 8; target.AddBuff(BuffID.Frostburn, 100); } - } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs index 87103c58b6..b1bd3c5b9e 100644 --- a/Projectiles/Melee/Spears/UrchinSpearProjectile.cs +++ b/Projectiles/Melee/Spears/UrchinSpearProjectile.cs @@ -28,7 +28,8 @@ namespace CalamityMod.Projectiles.Melee.Spears projectile.penetrate = -1; projectile.ownerHitCheck = true; projectile.hide = true; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/TerrorBeam.cs b/Projectiles/Melee/TerrorBeam.cs index 6b2329ec90..644eb46f26 100644 --- a/Projectiles/Melee/TerrorBeam.cs +++ b/Projectiles/Melee/TerrorBeam.cs @@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Melee { public class TerrorBeam : ModProjectile { + private bool hasHitEnemy = false; + public override void SetStaticDefaults() { DisplayName.SetDefault("Beam"); @@ -56,8 +58,9 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (projectile.owner == Main.myPlayer) + if (projectile.owner == Main.myPlayer && !hasHitEnemy) { + hasHitEnemy = true; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("TerrorBoom"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } @@ -75,7 +78,6 @@ namespace CalamityMod.Projectiles.Melee projectile.alpha = 0; } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; - return; } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Melee/TriactisOPHammerMelee.cs b/Projectiles/Melee/TriactisOPHammerMelee.cs index 3b47cc2271..0690299d4e 100644 --- a/Projectiles/Melee/TriactisOPHammerMelee.cs +++ b/Projectiles/Melee/TriactisOPHammerMelee.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -109,8 +110,8 @@ namespace CalamityMod.Projectiles.Melee { return new Color(250, 250, 250, 50); } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (projectile.owner == Main.myPlayer) { diff --git a/Projectiles/Melee/Tumbleweed.cs b/Projectiles/Melee/Tumbleweed.cs index e45b73c54b..ce4d3e8255 100644 --- a/Projectiles/Melee/Tumbleweed.cs +++ b/Projectiles/Melee/Tumbleweed.cs @@ -24,7 +24,8 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.melee = true; projectile.alpha = 255; - } + projectile.GetGlobalProjectile(mod).trueMelee = true; + } public override void AI() { diff --git a/Projectiles/Melee/UltimusCleaverDust.cs b/Projectiles/Melee/UltimusCleaverDust.cs new file mode 100644 index 0000000000..9561d58d28 --- /dev/null +++ b/Projectiles/Melee/UltimusCleaverDust.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class UltimusCleaverDust : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultimus Flame"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 5; + projectile.timeLeft = 120; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + projectile.tileCollide = false; + projectile.melee = true; + } + + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + if (projectile.ai[1] == 0f) + { + projectile.ai[1] = 1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 13); + } + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; + if (Main.rand.Next(2) == 0) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 246, 0f, 0f, 100, new Color(255, Main.DiscoG, 53), 1f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + return; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Melee/UltimusCleaverDust.png b/Projectiles/Melee/UltimusCleaverDust.png new file mode 100644 index 0000000000..ee4239cbf9 Binary files /dev/null and b/Projectiles/Melee/UltimusCleaverDust.png differ diff --git a/Projectiles/Melee/Whirlpool.cs b/Projectiles/Melee/Whirlpool.cs new file mode 100644 index 0000000000..8010d79057 --- /dev/null +++ b/Projectiles/Melee/Whirlpool.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class Whirlpool : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Whirlpool"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 60; + projectile.height = 60; + projectile.scale = 0.5f; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.penetrate = 2; + projectile.melee = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0f, 0f, projectile.scale * 1.5f); + int num626 = 6; + for (int num627 = 0; num627 < num626; num627++) + { + Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)((float)num626), default(Vector2)) + projectile.Center; + Vector2 value15 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num628 = Dust.NewDust(vector45 + value15, 0, 0, 172, value15.X * 2f, value15.Y * 2f, 100, default(Color), projectile.scale); + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + if (projectile.scale <= 1f) + { + projectile.scale *= 1.015f; + } + if (projectile.scale >= 1f) + { + projectile.Kill(); + } + projectile.frameCounter++; + if (projectile.frameCounter > 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 3) + { + projectile.frame = 0; + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(4, (int)projectile.Center.X, (int)projectile.Center.Y, 19); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 172, vector7.X * 2f, vector7.Y * 2f, 100, default(Color), 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Melee/Whirlpool.png b/Projectiles/Melee/Whirlpool.png new file mode 100644 index 0000000000..90a422dbd8 Binary files /dev/null and b/Projectiles/Melee/Whirlpool.png differ diff --git a/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs b/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs index fb2dcb3a54..f3ffd5c25f 100644 --- a/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs +++ b/Projectiles/Melee/Yoyos/AirSpinnerProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,5 +28,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos ProjectileID.Sets.TrailingMode[projectile.type] = 0; aiType = ProjectileID.Valor; } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Yoyos/AortaProjectile.cs b/Projectiles/Melee/Yoyos/AortaProjectile.cs index 82e190e071..79b09bd20c 100644 --- a/Projectiles/Melee/Yoyos/AortaProjectile.cs +++ b/Projectiles/Melee/Yoyos/AortaProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,5 +27,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos ProjectileID.Sets.TrailingMode[projectile.type] = 0; aiType = ProjectileID.Valor; } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Yoyos/AzathothProjectile.cs b/Projectiles/Melee/Yoyos/AzathothProjectile.cs index 595a8c659c..acaa363ca8 100644 --- a/Projectiles/Melee/Yoyos/AzathothProjectile.cs +++ b/Projectiles/Melee/Yoyos/AzathothProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,5 +39,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } } } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs b/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs index 233adbeffb..8288587442 100644 --- a/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs +++ b/Projectiles/Melee/Yoyos/ChaotrixProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -41,5 +42,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); } } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Yoyos/CnidarianProjectile.cs b/Projectiles/Melee/Yoyos/CnidarianProjectile.cs index 7c2f3bd21f..c5b0762511 100644 --- a/Projectiles/Melee/Yoyos/CnidarianProjectile.cs +++ b/Projectiles/Melee/Yoyos/CnidarianProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,5 +25,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos projectile.melee = true; aiType = 542; } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Yoyos/LaceratorProjectile.cs b/Projectiles/Melee/Yoyos/LaceratorProjectile.cs index 63fbb6fa24..0e7a035683 100644 --- a/Projectiles/Melee/Yoyos/LaceratorProjectile.cs +++ b/Projectiles/Melee/Yoyos/LaceratorProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -41,5 +42,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos player.HealEffect(1); } } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } } } \ No newline at end of file diff --git a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs b/Projectiles/Melee/Yoyos/QuagmireProjectile.cs index db1e980e67..60a23d5371 100644 --- a/Projectiles/Melee/Yoyos/QuagmireProjectile.cs +++ b/Projectiles/Melee/Yoyos/QuagmireProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,16 +36,19 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { if (Main.rand.Next(10) == 0) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, 569, (int)((double)projectile.damage * 0.65f), projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.35f, projectile.velocity.Y * 0.35f, 569, (int)((double)projectile.damage * 0.65), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } if (Main.rand.Next(30) == 0) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 570, (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 570, (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } if (Main.rand.Next(50) == 0) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.15f, projectile.velocity.Y * 0.15f, 571, (int)((double)projectile.damage * 0.85f), projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 0.15f, projectile.velocity.Y * 0.15f, 571, (int)((double)projectile.damage * 0.85), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } } } @@ -52,5 +56,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { target.AddBuff(BuffID.Venom, 200); } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs b/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs index 49d7f61e66..270c0c6a06 100644 --- a/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs +++ b/Projectiles/Melee/Yoyos/ShimmersparkProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -76,15 +77,22 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 92, projectile.damage, projectile.knockBack, projectile.owner, 1f, 0f); - } + int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 92, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } } - return; } } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(BuffID.Frostburn, 100); } diff --git a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs index 784cc3cb5e..8b35462fbe 100644 --- a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs +++ b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -41,8 +42,16 @@ namespace CalamityMod.Projectiles.Melee.Yoyos target.AddBuff(mod.BuffType("HolyLight"), 300); if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("HolyExplosionSupreme"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; + } } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs b/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs index 880c6ac327..21f5656eaf 100644 --- a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs +++ b/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -70,9 +71,8 @@ namespace CalamityMod.Projectiles.Melee.Yoyos num439 *= num440; if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("BrimstoneLaserFriendly"), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("BrimstoneLaserFriendly"), (int)((double)projectile.damage * 0.25), projectile.knockBack, projectile.owner, 0f, 0f); } - return; } } } @@ -81,5 +81,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.png b/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.png index 93ab753467..e257247fc8 100644 Binary files a/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.png and b/Projectiles/Melee/Yoyos/TheEyeofCalamitasProjectile.png differ diff --git a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs b/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs index b6dd692e4c..3239b03578 100644 --- a/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs +++ b/Projectiles/Melee/Yoyos/TheGodsGambitProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -40,5 +41,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { target.AddBuff(BuffID.Slimed, 200); } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Yoyos/TheObliterator.cs b/Projectiles/Melee/Yoyos/TheObliterator.cs index d10cfdd678..0b6b31247c 100644 --- a/Projectiles/Melee/Yoyos/TheObliterator.cs +++ b/Projectiles/Melee/Yoyos/TheObliterator.cs @@ -73,7 +73,8 @@ namespace CalamityMod.Projectiles.Melee.Yoyos num439 *= num440; if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), (int)((double)projectile.damage * 0.75), projectile.knockBack, projectile.owner, 1f, 0f); + int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; } } } diff --git a/Projectiles/Melee/Yoyos/ThePlaguebringer.cs b/Projectiles/Melee/Yoyos/ThePlaguebringer.cs index fe9f3a7d84..411fe3dae8 100644 --- a/Projectiles/Melee/Yoyos/ThePlaguebringer.cs +++ b/Projectiles/Melee/Yoyos/ThePlaguebringer.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -70,9 +71,8 @@ namespace CalamityMod.Projectiles.Melee.Yoyos num439 *= num440; if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("PlagueSeeker"), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("PlagueSeeker"), (int)((double)projectile.damage * 0.5), projectile.knockBack, projectile.owner, 0f, 0f); } - return; } } } @@ -81,5 +81,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { target.AddBuff(mod.BuffType("Plague"), 600); } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Yoyos/VerdantProjectile.cs b/Projectiles/Melee/Yoyos/VerdantProjectile.cs index 2d36ccc25a..286ca2ec35 100644 --- a/Projectiles/Melee/Yoyos/VerdantProjectile.cs +++ b/Projectiles/Melee/Yoyos/VerdantProjectile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -78,10 +79,10 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 227, (int)((double)projectile.damage * 0.75f), projectile.knockBack, projectile.owner, 0f, 0f); + int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, 227, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceMelee = true; } } - return; } } } @@ -91,5 +92,12 @@ namespace CalamityMod.Projectiles.Melee.Yoyos target.AddBuff(BuffID.OnFire, 200); target.AddBuff(BuffID.CursedInferno, 200); } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Melee/Yoyos/YinYo.cs b/Projectiles/Melee/Yoyos/YinYo.cs index f53a0a3453..12f1a56275 100644 --- a/Projectiles/Melee/Yoyos/YinYo.cs +++ b/Projectiles/Melee/Yoyos/YinYo.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -83,9 +84,15 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } } } - return; } } } - } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Patreon/Akato.cs b/Projectiles/Patreon/Akato.cs new file mode 100644 index 0000000000..78835bcdfa --- /dev/null +++ b/Projectiles/Patreon/Akato.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class Akato : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Akato"); + Main.projFrames[projectile.type] = 6; + Main.projPet[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 60; + projectile.height = 60; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (!player.active) + { + projectile.active = false; + return; + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.dead) + { + modPlayer.akato = false; + } + if (modPlayer.akato) + { + projectile.timeLeft = 2; + } + float num16 = 0.5f; + projectile.tileCollide = false; + int num17 = 100; + Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num18 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; + float num19 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; + num19 += (float)Main.rand.Next(-10, 21); + num18 += (float)Main.rand.Next(-10, 21); + num18 += (float)(60 * -(float)Main.player[projectile.owner].direction); + num19 -= 60f; + float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19)); + float num21 = 18f; + if (num20 < (float)num17 && Main.player[projectile.owner].velocity.Y == 0f && + projectile.position.Y + (float)projectile.height <= Main.player[projectile.owner].position.Y + (float)Main.player[projectile.owner].height && + !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + if (projectile.velocity.Y < -6f) + { + projectile.velocity.Y = -6f; + } + } + if (num20 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num20 < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.99f; + } + num16 = 0.01f; + } + else + { + if (num20 < 100f) + { + num16 = 0.1f; + } + if (num20 > 300f) + { + num16 = 1f; + } + num20 = num21 / num20; + num18 *= num20; + num19 *= num20; + } + if (projectile.velocity.X < num18) + { + projectile.velocity.X = projectile.velocity.X + num16; + if (num16 > 0.05f && projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X + num16; + } + } + if (projectile.velocity.X > num18) + { + projectile.velocity.X = projectile.velocity.X - num16; + if (num16 > 0.05f && projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X - num16; + } + } + if (projectile.velocity.Y < num19) + { + projectile.velocity.Y = projectile.velocity.Y + num16; + if (num16 > 0.05f && projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + } + } + if (projectile.velocity.Y > num19) + { + projectile.velocity.Y = projectile.velocity.Y - num16; + if (num16 > 0.05f && projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + } + } + if ((double)projectile.velocity.X >= 0.25) + { + projectile.direction = 1; + } + else if ((double)projectile.velocity.X < -0.25) + { + projectile.direction = -1; + } + projectile.spriteDirection = projectile.direction; + projectile.rotation = projectile.velocity.X * 0.02f; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 5) + { + projectile.frame = 0; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Patreon/Akato.png b/Projectiles/Patreon/Akato.png new file mode 100644 index 0000000000..58c08e3b89 Binary files /dev/null and b/Projectiles/Patreon/Akato.png differ diff --git a/Projectiles/Patreon/DraconicSpark.cs b/Projectiles/Patreon/DraconicSpark.cs new file mode 100644 index 0000000000..303e645063 --- /dev/null +++ b/Projectiles/Patreon/DraconicSpark.cs @@ -0,0 +1,133 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Patreon; + +namespace CalamityMod.Projectiles.Patreon +{ + public class DraconicSpark : ModProjectile + { + public static int Lifetime = 120; + public static float MaxHomingRange = 600f; + public static float HomingVelocity = 20f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Draconic Spark"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = Lifetime; + projectile.alpha = 255; + } + + // ai[0] controls what type of Draconic Spark this is. + // 0 = Orange spark (inflicts Daybroken) + // 1 = Red spark (inflicts Abyssal Flames) + // 2 = Yellow spark (inflicts Holy Flames) + public override void AI() + { + DrawProjectile(); + + // Homing code copied from Arch Amaryllis + ArchAmaryllisHoming(); + } + + private void ArchAmaryllisHoming() + { + float targetX = projectile.Center.X; + float targetY = projectile.Center.Y; + bool foundTarget = false; + float maxRange = MaxHomingRange; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + float iterCenterX = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float iterCenterY = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2); + float dist = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - iterCenterX) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - iterCenterY); + if (dist < maxRange) + { + maxRange = dist; + targetX = iterCenterX; + targetY = iterCenterY; + foundTarget = true; + } + } + } + if (foundTarget) + { + float speed = HomingVelocity; + Vector2 projCenter = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float xDist = targetX - projCenter.X; + float yDist = targetY - projCenter.Y; + float dist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + dist = speed / dist; + xDist *= dist; + yDist *= dist; + projectile.velocity.X = (projectile.velocity.X * 20f + xDist) / 21f; + projectile.velocity.Y = (projectile.velocity.Y * 20f + yDist) / 21f; + return; + } + } + + // Debuff applied depends on spark color. + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.ai[0] == 0f) + target.AddBuff(BuffID.Daybreak, 180); + else if(projectile.ai[0] == 1f) + target.AddBuff(mod.BuffType("AbyssalFlames"), 180); + else if(projectile.ai[0] == 2f) + target.AddBuff(mod.BuffType("HolyLight"), 180); + } + + // Pure dust projectile, but dust used depends on AI variables + private void DrawProjectile() + { + if(projectile.ai[0] == 0) // daybroken spark + { + int dustID = 244; + if (Main.rand.Next(3) != 0) + { + float scale = Main.rand.NextFloat(0.8f, 1.4f); + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity += projectile.velocity * 0.1f; + } + } + else if(projectile.ai[0] == 1) // abyssal flames spark + { + int dustID = 235; + if(Main.rand.Next(3) != 0) + { + float scale = Main.rand.NextFloat(0.6f, 1.2f); + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID, 0f, 0f, 100, default(Color), scale); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity += projectile.velocity * 0.1f; + } + } + else if(projectile.ai[0] == 2) // holy flames spark + { + int dustID = 246; + if(Main.rand.Next(3) != 0) + { + float scale = Main.rand.NextFloat(0.8f, 1.4f); + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustID); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity += projectile.velocity * 0.1f; + } + } + } + } +} diff --git a/Projectiles/Patreon/DraconicSpark.png b/Projectiles/Patreon/DraconicSpark.png new file mode 100644 index 0000000000..ead80128fa Binary files /dev/null and b/Projectiles/Patreon/DraconicSpark.png differ diff --git a/Projectiles/Patreon/DragonPowFlail.cs b/Projectiles/Patreon/DragonPowFlail.cs new file mode 100644 index 0000000000..f3c9e97a8c --- /dev/null +++ b/Projectiles/Patreon/DragonPowFlail.cs @@ -0,0 +1,264 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Patreon; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Projectiles.Patreon +{ + public class DragonPowFlail : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dragon Pow"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.extraUpdates = 2; + + // Only hits enemies once, but doesn't give them iframes so sparks and explosions can hit. + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + + projectile.alpha = 255; + } + + // ai[0] = flail's current behavior state + // 0 = flail is heading outwards + // 1 = flail is coming back (Any other value also makes the flail return) + // ai[1] = tick counter used to spawn projectiles and control transparency + public override void AI() + { + drawOffsetX = 0; + drawOriginOffsetY = -11; + drawOriginOffsetX = 0; + + Player owner = Main.player[projectile.owner]; + + // Update facing so it's always directly away from player + Vector2 posDiff = owner.Center - projectile.Center; + projectile.rotation = posDiff.ToRotation(); + + // Destroy immediately if the owner is dead + if (owner.dead) + { + projectile.Kill(); + return; + } + + // Make the owner face the correct direction for the flail + if (posDiff.X < 0f) + { + owner.ChangeDir(1); + projectile.direction = 1; + projectile.spriteDirection = 1; + projectile.rotation += MathHelper.Pi; // keep dragon head facing up + } + else + { + owner.ChangeDir(-1); + projectile.direction = -1; + projectile.spriteDirection = -1; + } + + // Keep the owner's hand out for as long as necessary and face it the right way + owner.itemRotation = (-1f * posDiff * (float)projectile.direction).ToRotation(); + owner.itemAnimation = 6; + owner.itemTime = 6; + + // If the flail is far enough out and still "heading out", then swap it to be returning + float dist = posDiff.Length(); + if (projectile.ai[0] == 0f && dist > 800f) + projectile.ai[0] = 1f; + + // Flail returning behavior + if (projectile.ai[0] != 0f) + { + // If the flail gets way too far away, just destroy it + if (dist > 1500f) + { + projectile.Kill(); + return; + } + + // Set velocity to be directly towards the player + projectile.velocity = posDiff.SafeNormalize(Vector2.Zero) * DragonPow.ReturnSpeed; + + // Once the flail is close enough to the player, destroy it + if (posDiff.Length() < DragonPow.ReturnSpeed) + { + projectile.Kill(); + return; + } + } + + // Creates a flurry of dust + int numDust = 5; + for (int i = 0; i < numDust; ++i) + { + int dustType = (Main.rand.Next(3) == 0) ? 246 : 244; + float scale = 0.8f + Main.rand.NextFloat(0.6f); + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + Main.dust[idx].noGravity = true; + Main.dust[idx].scale = scale; + Main.dust[idx].velocity *= 2f; + Main.dust[idx].velocity += projectile.velocity * 0.3f; + } + + // Increment the frame counter + ++projectile.ai[1]; + + // If the flail has been out for at least 5 frames, make it visible + projectile.alpha = (projectile.ai[1] > 5f) ? 0 : 255; + + if (projectile.ai[1] % 4 == 0) + { + int type = mod.ProjectileType("DraconicSpark"); + int damage = DragonPow.BaseDamage / 8; + float kb = 3f; + float speed = DragonPow.SparkSpeed; + Vector2 vel = new Vector2(speed, 0f).RotatedByRandom(MathHelper.TwoPi); + vel += projectile.velocity * 0.05f; + float sparkVariety = Main.rand.Next(3); + + if(projectile.owner == Main.myPlayer) + Projectile.NewProjectile(projectile.Center, vel, type, damage, kb, projectile.owner, sparkVariety, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // Inflicts Daybroken, Abyssal Flames and Holy Flames for 8 seconds on-hit + target.AddBuff(BuffID.Daybreak, 480); + target.AddBuff(mod.BuffType("AbyssalFlames"), 480); + target.AddBuff(mod.BuffType("HolyLight"), 480); + + projectile.ai[0] = 1f; + projectile.netUpdate = true; + + // No petals or waterfalls when hitting dummies. + if (target.type == NPCID.TargetDummy) + return; + + PetalStorm(target, damage, knockback, crit); + Waterfalls(target, damage, knockback, crit); + } + + // Spawns a storm of flower petals on-hit. + private void PetalStorm(NPC target, int damage, float knockback, bool crit) + { + Main.PlaySound(SoundID.Item105, target.Center); + + int type = ProjectileID.FlowerPetal; + int numPetals = 12; + int petalDamage = DragonPow.BaseDamage / 8; + float petalKB = 0f; + Player owner = Main.player[projectile.owner]; + for (int i = 0; i < numPetals; ++i) + { + float startOffsetX = Main.rand.NextFloat(1000f, 1400f) * (Main.rand.NextBool() ? -1f : 1f); + float startOffsetY = Main.rand.NextFloat(80f, 900f) * (Main.rand.NextBool() ? -1f : 1f); + Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); + float dx = target.Center.X - startPos.X; + float dy = target.Center.Y - startPos.Y; + + // Add some randomness / inaccuracy to the petal target location + dx += Main.rand.NextFloat(-5f, 5f); + dy += Main.rand.NextFloat(-5f, 5f); + float speed = Main.rand.NextFloat(DragonPow.MinPetalSpeed, DragonPow.MaxPetalSpeed); + float dist = (float)Math.Sqrt((double)(dx * dx + dy * dy)); + dist = speed / dist; + dx *= dist; + dy *= dist; + Vector2 petalVel = new Vector2(dx, dy); + float angle = Main.rand.NextFloat(MathHelper.TwoPi); + if (projectile.owner == Main.myPlayer) + { + int idx = Projectile.NewProjectile(startPos, petalVel, type, petalDamage, petalKB, projectile.owner, 0f, 0f); + Main.projectile[idx].rotation = angle; + Main.projectile[idx].melee = true; + Main.projectile[idx].usesLocalNPCImmunity = true; + Main.projectile[idx].localNPCHitCooldown = -1; + } + } + } + + private void Waterfalls(NPC target, int damage, float knockback, bool crit) + { + int type = mod.ProjectileType("OceanBeam"); + int numWaterfalls = 12; + int waterfallDamage = DragonPow.BaseDamage / 6; + float waterfallKB = 0f; + Player owner = Main.player[projectile.owner]; + for(int i = 0; i < numWaterfalls; ++i) + { + float startOffsetX = Main.rand.NextFloat(-120f, 120f); + float startOffsetY = Main.rand.NextFloat(-740f, -700f); + Vector2 startPos = new Vector2(target.Center.X + startOffsetX, target.Center.Y + startOffsetY); + float fallSpeed = Main.rand.NextFloat(DragonPow.MinWaterfallSpeed, DragonPow.MaxWaterfallSpeed); + Vector2 fallVec = new Vector2(0f, fallSpeed); + fallVec = fallVec.RotatedBy(Main.rand.NextFloat(-0.08f, 0.08f)); + + if (projectile.owner == Main.myPlayer) + { + int idx = Projectile.NewProjectile(startPos, fallVec, type, waterfallDamage, waterfallKB, projectile.owner, 0f, 0f); + Main.projectile[idx].timeLeft = 100; + Main.projectile[idx].tileCollide = false; + } + } + } + + // PreDraw draws the flail's chain (underneath it, so it doesn't look weird) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Player owner = Main.player[projectile.owner]; + Vector2 mountedCenter = owner.MountedCenter; + Color transparent = Color.Transparent; + Texture2D chainTex = mod.GetTexture("ExtraTextures/Chains/DragonPowChain"); + Vector2 chainDrawPos = projectile.Center; + + Rectangle? sourceRectangle = null; + Vector2 origin = new Vector2(chainTex.Width * 0.5f, chainTex.Height * 0.5f); + + Vector2 posDiff = mountedCenter - chainDrawPos; + float rot = (float)Math.Atan2(posDiff.Y, posDiff.X) - MathHelper.PiOver2; + + // If going right: Flip chain segments over so they face upwards + if (posDiff.X < 0f) + rot += MathHelper.Pi; + + // Just don't draw anything if there's NaNs to prevent crashes + bool keepDrawing = true; + if (chainDrawPos.HasNaNs() || posDiff.HasNaNs()) + keepDrawing = false; + + // Draw chain segments until you run out of space + while (keepDrawing) + { + // Stop drawing when closer than 1 chain link away. + if (posDiff.Length() < chainTex.Height + 1f) + { + keepDrawing = false; + break; + } + + Vector2 chainDirection = posDiff.SafeNormalize(Vector2.Zero); + chainDrawPos += chainDirection * chainTex.Height; + posDiff = mountedCenter - chainDrawPos; + Color colorAtLoc = Lighting.GetColor((int)chainDrawPos.X / 16, (int)chainDrawPos.Y / 16); + Main.spriteBatch.Draw(chainTex, chainDrawPos - Main.screenPosition, sourceRectangle, colorAtLoc, rot, origin, 1f, SpriteEffects.None, 0f); + } + return true; + } + } +} diff --git a/Projectiles/Patreon/DragonPowFlail.png b/Projectiles/Patreon/DragonPowFlail.png new file mode 100644 index 0000000000..eba43c37f3 Binary files /dev/null and b/Projectiles/Patreon/DragonPowFlail.png differ diff --git a/Projectiles/Patreon/LightBall.cs b/Projectiles/Patreon/LightBall.cs index 1b4b3cdd24..fa0d4e12b4 100644 --- a/Projectiles/Patreon/LightBall.cs +++ b/Projectiles/Patreon/LightBall.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Patreon projectile.position.X = projectile.position.X - (float)(projectile.width / 2); projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("LightBallExplosion"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - for (int num621 = 0; num621 < 30; num621++) + for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 212, 0f, 0f, 100, default(Color), 1.2f); Main.dust[num622].velocity *= 3f; @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Patreon Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 60; num623++) + for (int num623 = 0; num623 < 20; num623++) { int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 212, 0f, 0f, 100, default(Color), 1.7f); Main.dust[num624].noGravity = true; diff --git a/Projectiles/Patreon/LightBead.cs b/Projectiles/Patreon/LightBead.cs index 7851c9a16c..487cb3a3ff 100644 --- a/Projectiles/Patreon/LightBead.cs +++ b/Projectiles/Patreon/LightBead.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Patreon Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f); projectile.rotation += projectile.velocity.X * 0.2f; projectile.ai[1] += 1f; - if (Main.rand.Next(4) == 0) + if (Main.rand.Next(6) == 0) { int num300 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 212, 0f, 0f, 0, default(Color), 1f); Main.dust[num300].noGravity = true; @@ -80,13 +80,12 @@ namespace CalamityMod.Projectiles.Patreon num485 *= num486; projectile.velocity.X = (projectile.velocity.X * 10f + num484) / 11f; projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; - return; } } public override void Kill(int timeLeft) { - for (int k = 0; k < 5; k++) + for (int k = 0; k < 3; k++) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 212, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } diff --git a/Projectiles/Patreon/LightBeadSplit.cs b/Projectiles/Patreon/LightBeadSplit.cs index 2f138c31b5..7b1a9c9860 100644 --- a/Projectiles/Patreon/LightBeadSplit.cs +++ b/Projectiles/Patreon/LightBeadSplit.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Patreon public override void Kill(int timeLeft) { - for (int k = 0; k < 5; k++) + for (int k = 0; k < 3; k++) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 212, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } diff --git a/Projectiles/Patreon/OracleYoyo.cs b/Projectiles/Patreon/OracleYoyo.cs new file mode 100644 index 0000000000..3facfd931d --- /dev/null +++ b/Projectiles/Patreon/OracleYoyo.cs @@ -0,0 +1,225 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Patreon; + +namespace CalamityMod.Projectiles.Patreon +{ + public class OracleYoyo : ModProjectile + { + // projectile.localAI[1] is the Aura Charge of the red lightning aura + // Minimum value is zero. Maximum value is 200. + // The aura turns on and begins damaging enemies at 20 charge. + // The yoyo "supercharges" at 50 charge. + // Its size caps out at 100 charge. + private static float MaxCharge = 200f; + private static float MinAuraRadius = 20f; + private static float SuperchargeThreshold = 50f; + private static float MaxAuraRadius = 100f; + private static float MinDischargeRate = 0.05f; + private static float MaxDischargeRate = 0.53f; + private static float ChargePerHit = 6f; + + private static int AuraBaseDamage = 40; + private static int HitsPerOrbVolley = 6; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Oracle"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + aiType = 554; + projectile.width = 20; + projectile.height = 20; + projectile.scale = 1.2f; + projectile.melee = true; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 4; + } + + public override void AI() + { + // Produces golden dust constantly while in flight. This lights the yoyo. + if(Main.rand.NextBool()) + { + int dustType = (Main.rand.Next(3) == 0) ? 244 : 246; + float scale = 0.8f + Main.rand.NextFloat(0.6f); + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity = Vector2.Zero; + Main.dust[idx].scale = scale; + } + + // The aura discharges over time based on its current charge. + float discharge = MinDischargeRate + 0.003f * projectile.localAI[1]; + if (discharge > MaxDischargeRate) + discharge = MaxDischargeRate; + projectile.localAI[1] -= discharge; + + // Boundary checks on aura charge + if (projectile.localAI[1] < 0f) + projectile.localAI[1] = 0f; + if (projectile.localAI[1] > MaxCharge) + projectile.localAI[1] = MaxCharge; + + // If the aura is large enough to be considered "on", draw it, make sound and damage enemies + if (projectile.localAI[1] > MinAuraRadius) + { + float auraRadius = projectile.localAI[1] > MaxAuraRadius ? MaxAuraRadius : projectile.localAI[1]; + DrawRedLightningAura(auraRadius); + + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 22; + Main.PlaySound(SoundID.Item93, (int)projectile.Center.X, (int)projectile.Center.Y); + } + + // The aura's direct damage scales with its charge: 100 base damage + 1 per charge point + int auraDamage = (int)(AuraBaseDamage + projectile.localAI[1]); + DealAuraDamage(auraRadius, auraDamage); + } + else + projectile.soundDelay = 2; + + projectile.netUpdate = true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + // The yoyo does nothing versus normal dummies + if (target.type == NPCID.TargetDummy) + return; + + // Charge up the red lightning aura with every hit + projectile.localAI[1] += ChargePerHit; + + // Fire Auric orbs every few hits while supercharged. + if (projectile.localAI[1] > SuperchargeThreshold && projectile.numHits % HitsPerOrbVolley == 0) + FireAuricOrbs(); + } + + // Uses dust type 260, which lives for an extremely short amount of time + private void DrawRedLightningAura(float radius) + { + // Light emits from the yoyo itself while the aura is active, eventually becoming insanely bright + float brightness = radius * 0.03f; + Lighting.AddLight(projectile.Center, brightness, 0.2f * brightness, 0.1f * brightness); + + // Number of particles on the circumference scales directly with the circumference + float dustDensity = 0.2f; + int numDust = (int)(dustDensity * MathHelper.TwoPi * radius); + float angleIncrement = MathHelper.TwoPi / (float)numDust; + + // Incrementally rotate the vector as a ring of dust is drawn + Vector2 dustOffset = new Vector2(radius, 0f); + dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); + for (int i = 0; i < numDust; ++i) + { + dustOffset = dustOffset.RotatedBy(angleIncrement); + int dustType = 260; + float scale = 1.6f + Main.rand.NextFloat(0.9f); + int idx = Dust.NewDust(projectile.Center, 1, 1, dustType); + Main.dust[idx].position = projectile.Center + dustOffset; + Main.dust[idx].noGravity = true; + Main.dust[idx].noLight = true; + Main.dust[idx].velocity *= 0.5f; + Main.dust[idx].scale = scale; + } + + // Rarely, draw some "arcs" which are lines of dust to the edge + if (Main.rand.Next(30) == 0) + { + int numArcs = 3; + float arcDustDensity = 0.6f; + if (Main.rand.NextBool()) ++numArcs; + if (Main.rand.NextBool()) ++numArcs; + + Vector2 radiusVec = new Vector2(radius, 0f); + int dustPerArc = (int)(arcDustDensity * radius); + for (int i = 0; i < numArcs; ++i) + { + radiusVec = radiusVec.RotatedByRandom(MathHelper.TwoPi); + for(int j = 0; j < dustPerArc; ++j) + { + Vector2 partialRadius = ((float)j / dustPerArc) * radiusVec; + int dustType = 260; + float scale = 1.6f + Main.rand.NextFloat(0.9f); + int idx = Dust.NewDust(projectile.Center, 1, 1, dustType); + Main.dust[idx].position = projectile.Center + partialRadius; + Main.dust[idx].noGravity = true; + Main.dust[idx].noLight = true; + Main.dust[idx].velocity *= 0.3f; + Main.dust[idx].scale = scale; + } + } + + // Make extra sound when these arcs happen + Main.PlaySound(SoundID.NPCHit53, (int)projectile.Center.X, (int)projectile.Center.Y); + } + } + + private void DealAuraDamage(float radius, int baseDamage) + { + if (projectile.owner != Main.myPlayer) + return; + Player owner = Main.player[projectile.owner]; + + for (int i = 0; i < 200; ++i) + { + NPC target = Main.npc[i]; + if (!target.active || target.dontTakeDamage || target.friendly) + continue; + + // Shock any valid target within range. Check all four corners of their hitbox. + float d1 = Vector2.Distance(projectile.Center, target.Hitbox.TopLeft()); + float d2 = Vector2.Distance(projectile.Center, target.Hitbox.TopRight()); + float d3 = Vector2.Distance(projectile.Center, target.Hitbox.BottomLeft()); + float d4 = Vector2.Distance(projectile.Center, target.Hitbox.BottomRight()); + float dist = MathHelper.Min(d1, d2); + dist = MathHelper.Min(dist, d3); + dist = MathHelper.Min(dist, d4); + + if (dist <= radius) + { + int finalDamage = (int)(baseDamage * owner.meleeDamage * Main.rand.NextFloat(0.85f, 1.15f)); + bool crit = Main.rand.Next(100) <= owner.meleeCrit + 4; + target.StrikeNPC(finalDamage, 0f, 0, crit, false, false); + + if (Main.netMode != 0) + NetMessage.SendData(28, -1, -1, null, i, finalDamage, 0f, 0f, crit?1:0, 0, 0); + } + } + } + + private void FireAuricOrbs() + { + // Play a sound when orbs are fired + Main.PlaySound(SoundID.Item92, (int)projectile.Center.X, (int)projectile.Center.Y); + + int numOrbs = 3; + int orbID = mod.ProjectileType("Orbacle"); + int orbDamage = Oracle.BaseDamage * 3; + float orbKB = 8f; + float angleVariance = MathHelper.TwoPi / (float)numOrbs; + float spinOffsetAngle = MathHelper.Pi / (2f * numOrbs); + Vector2 posVec = new Vector2(2f, 0f).RotatedByRandom(MathHelper.TwoPi); + + for (int i = 0; i < numOrbs; ++i) + { + posVec = posVec.RotatedBy(angleVariance); + Vector2 velocity = new Vector2(posVec.X, posVec.Y).RotatedBy(spinOffsetAngle); + velocity.Normalize(); + velocity *= 18f; + if(projectile.owner == Main.myPlayer) + Projectile.NewProjectile(projectile.Center + posVec, velocity, orbID, orbDamage, orbKB, Main.myPlayer, 0.0f, 0.0f); + } + } + } +} diff --git a/Projectiles/Patreon/OracleYoyo.png b/Projectiles/Patreon/OracleYoyo.png new file mode 100644 index 0000000000..19b10a8714 Binary files /dev/null and b/Projectiles/Patreon/OracleYoyo.png differ diff --git a/Projectiles/Patreon/Orbacle.cs b/Projectiles/Patreon/Orbacle.cs new file mode 100644 index 0000000000..f00d6e2895 --- /dev/null +++ b/Projectiles/Patreon/Orbacle.cs @@ -0,0 +1,51 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Patreon; + +namespace CalamityMod.Projectiles.Patreon +{ + public class Orbacle : ModProjectile + { + private static int Lifetime = 40; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Auric Orb"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.melee = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + projectile.timeLeft = Lifetime; + + projectile.alpha = 80; + + // Auric orbs never hit the same enemy more than once. + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + // Produces golden dust while in flight + int dustType = (Main.rand.Next(3) == 0) ? 244 : 246; + float scale = 0.8f + Main.rand.NextFloat(0.6f); + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity = projectile.velocity / 3f; + Main.dust[idx].scale = scale; + + projectile.alpha += 4; + projectile.velocity *= 0.88f; + } + } +} diff --git a/Projectiles/Patreon/Orbacle.png b/Projectiles/Patreon/Orbacle.png new file mode 100644 index 0000000000..f854920b88 Binary files /dev/null and b/Projectiles/Patreon/Orbacle.png differ diff --git a/Projectiles/Patreon/PlagueBee.cs b/Projectiles/Patreon/PlagueBee.cs new file mode 100644 index 0000000000..002ce196b6 --- /dev/null +++ b/Projectiles/Patreon/PlagueBee.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class PlagueBee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plague Bee"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.timeLeft = 420; + projectile.ignoreWater = true; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + if (projectile.velocity.X > 0f) + { + projectile.spriteDirection = 1; + } + else if (projectile.velocity.X < 0f) + { + projectile.spriteDirection = -1; + } + projectile.rotation = projectile.velocity.X * 0.05f; + projectile.frameCounter++; + if (projectile.frameCounter >= 3) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame >= 3) + { + projectile.frame = 0; + } + float num373 = projectile.position.X; + float num374 = projectile.position.Y; + float num375 = 100000f; + bool flag10 = false; + projectile.ai[0] += 1f; + if (projectile.ai[0] > 30f) + { + projectile.ai[0] = 30f; + int num3; + for (int num376 = 0; num376 < 200; num376 = num3 + 1) + { + if (Main.npc[num376].CanBeChasedBy(projectile, false) && (!Main.npc[num376].wet || projectile.type == 307)) + { + float num377 = Main.npc[num376].position.X + (float)(Main.npc[num376].width / 2); + float num378 = Main.npc[num376].position.Y + (float)(Main.npc[num376].height / 2); + float num379 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num377) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num378); + if (num379 < 800f && num379 < num375 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num376].position, Main.npc[num376].width, Main.npc[num376].height)) + { + num375 = num379; + num373 = num377; + num374 = num378; + flag10 = true; + } + } + num3 = num376; + } + } + if (!flag10) + { + num373 = projectile.position.X + (float)(projectile.width / 2) + projectile.velocity.X * 100f; + num374 = projectile.position.Y + (float)(projectile.height / 2) + projectile.velocity.Y * 100f; + } + float num380 = 10f; + float num381 = 0.14f; + Vector2 vector30 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num382 = num373 - vector30.X; + float num383 = num374 - vector30.Y; + float num384 = (float)Math.Sqrt((double)(num382 * num382 + num383 * num383)); + num384 = num380 / num384; + num382 *= num384; + num383 *= num384; + if (projectile.velocity.X < num382) + { + projectile.velocity.X = projectile.velocity.X + num381; + if (projectile.velocity.X < 0f && num382 > 0f) + { + projectile.velocity.X = projectile.velocity.X + num381 * 2f; + } + } + else if (projectile.velocity.X > num382) + { + projectile.velocity.X = projectile.velocity.X - num381; + if (projectile.velocity.X > 0f && num382 < 0f) + { + projectile.velocity.X = projectile.velocity.X - num381 * 2f; + } + } + if (projectile.velocity.Y < num383) + { + projectile.velocity.Y = projectile.velocity.Y + num381; + if (projectile.velocity.Y < 0f && num383 > 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num381 * 2f; + } + } + else if (projectile.velocity.Y > num383) + { + projectile.velocity.Y = projectile.velocity.Y - num381; + if (projectile.velocity.Y > 0f && num383 < 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num381 * 2f; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + int num3; + for (int num418 = 0; num418 < 3; num418 = num3 + 1) + { + int num419 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 89, projectile.velocity.X, projectile.velocity.Y, 50, default(Color), 1f); + Main.dust[num419].noGravity = true; + Main.dust[num419].scale = 1f; + num3 = num418; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 300); + } + } +} \ No newline at end of file diff --git a/Projectiles/Patreon/PlagueBee.png b/Projectiles/Patreon/PlagueBee.png new file mode 100644 index 0000000000..7bbde31901 Binary files /dev/null and b/Projectiles/Patreon/PlagueBee.png differ diff --git a/Projectiles/Patreon/Plaguenade.cs b/Projectiles/Patreon/Plaguenade.cs new file mode 100644 index 0000000000..438693410e --- /dev/null +++ b/Projectiles/Patreon/Plaguenade.cs @@ -0,0 +1,154 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Patreon +{ + public class Plaguenade : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Plaguenade"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.extraUpdates = 1; + projectile.timeLeft = 180; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = oldVelocity.X * -0.5f; + } + if (projectile.velocity.Y != oldVelocity.Y && oldVelocity.Y > 1f) + { + projectile.velocity.Y = oldVelocity.Y * -0.5f; + } + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + int num3; + for (int num639 = 0; num639 < 20; num639 = num3 + 1) + { + float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; + float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; + Projectile.NewProjectile(projectile.position.X, projectile.position.Y, speedX, speedY, mod.ProjectileType("PlagueBee"), Main.player[projectile.owner].beeDamage(projectile.damage), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); + num3 = num639; + } + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 120; + projectile.height = 120; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.Damage(); + for (int num621 = 0; num621 < 20; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 30; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 89, 0f, 0f, 100, default(Color), 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + for (int num625 = 0; num625 < 3; 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(Vector2), Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.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(Vector2), Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.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(Vector2), Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.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(Vector2), Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13CFF_cp_0 = Main.gore[num626]; + expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f; + Gore expr_13D1F_cp_0 = Main.gore[num626]; + expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("Plague"), 600); + } + } +} \ No newline at end of file diff --git a/Projectiles/Patreon/Plaguenade.png b/Projectiles/Patreon/Plaguenade.png new file mode 100644 index 0000000000..16cbb3dd4e Binary files /dev/null and b/Projectiles/Patreon/Plaguenade.png differ diff --git a/Projectiles/Pets/Bear.cs b/Projectiles/Pets/Bear.cs index 80d5c07258..70acb01977 100644 --- a/Projectiles/Pets/Bear.cs +++ b/Projectiles/Pets/Bear.cs @@ -7,71 +7,82 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Pets { - public class Bear : ModProjectile - { + public class Bear : ModProjectile + { public int chosenIdle = 0; public int idleTimer = 0; public int playerStill = 0; public bool fly = false; public bool easyfix = true; - - public override void SetStaticDefaults() + + public override void SetStaticDefaults() { DisplayName.SetDefault("Bear"); - Main.projFrames[projectile.type] = 22; - Main.projPet[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 44; - projectile.height = 44; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.tileCollide = true; - } + Main.projFrames[projectile.type] = 22; + Main.projPet[projectile.type] = true; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - if (!player.active) - { - projectile.active = false; - return; - } - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (player.dead) - { - modPlayer.bearPet = false; - } - if (modPlayer.bearPet) - { - projectile.timeLeft = 2; - } - Vector2 vector46 = projectile.position; - if(easyfix) + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 44; + projectile.height = 44; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.tileCollide = true; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + Player player = Main.player[projectile.owner]; + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + fallThrough = playerDistance > 200f; + return true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (!player.active) + { + projectile.active = false; + return; + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.dead) + { + modPlayer.bearPet = false; + } + if (modPlayer.bearPet) + { + projectile.timeLeft = 2; + } + Vector2 vector46 = projectile.position; + if (easyfix) { projectile.position.Y += -3f; easyfix = false; } if (!fly) - { + { + projectile.rotation = 0; Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); if (projectile.velocity.Y == 0 && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) - { - projectile.velocity.Y = -5f; - } + { + projectile.velocity.Y = -5f; + } projectile.velocity.Y += 0.20f; - - if(projectile.velocity.Y > 7f) + + if (projectile.velocity.Y > 7f) { projectile.velocity.Y = 7f; } - + if (playerDistance > 600f) { fly = true; @@ -84,17 +95,17 @@ namespace CalamityMod.Projectiles.Pets if (player.position.X - projectile.position.X > 0f) { projectile.velocity.X += 0.10f; - - if(projectile.velocity.X > 7f) + + if (projectile.velocity.X > 7f) { projectile.velocity.X = 7f; } - } - else + } + else { projectile.velocity.X -= 0.10f; - - if (projectile.velocity.X < -7f) + + if (projectile.velocity.X < -7f) { projectile.velocity.X = -7f; } @@ -102,7 +113,7 @@ namespace CalamityMod.Projectiles.Pets } if (playerDistance < 100f) { - if (projectile.velocity.X != 0f) + if (projectile.velocity.X != 0f) { if (projectile.velocity.X > 0.5f) { @@ -114,113 +125,113 @@ namespace CalamityMod.Projectiles.Pets } else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) { - projectile.velocity.X = 0f; + projectile.velocity.X = 0f; } } } - if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) - { - projectile.frameCounter++; + if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) + { + projectile.frameCounter++; - switch (chosenIdle) - { - case 1: - if (idleTimer == 0) - { - projectile.frame = 0; - } - ++idleTimer; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - chosenIdle = 0; - } - if (projectile.frame < 1) - { - projectile.frame = 1; - } - break; + switch (chosenIdle) + { + case 1: + if (idleTimer == 0) + { + projectile.frame = 0; + } + ++idleTimer; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + chosenIdle = 0; + } + if (projectile.frame < 1) + { + projectile.frame = 1; + } + break; - case 2: - if (idleTimer == 0) - { - projectile.frame = 0; - } - ++idleTimer; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 9) - { - chosenIdle = 0; - } - if (projectile.frame < 4) - { - projectile.frame = 4; - } - break; + case 2: + if (idleTimer == 0) + { + projectile.frame = 0; + } + ++idleTimer; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 9) + { + chosenIdle = 0; + } + if (projectile.frame < 4) + { + projectile.frame = 4; + } + break; - case 3: - if (idleTimer == 0) - { - projectile.frame = 0; - } - ++idleTimer; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 12) - { - chosenIdle = 0; - } - if (projectile.frame < 10) - { - projectile.frame = 10; - } - break; - } - if (chosenIdle == 0) - { - projectile.frame = 0; - projectile.frameCounter = 5; - ++idleTimer; - if (idleTimer > 120) - { - chosenIdle = Main.rand.Next(1, 4); - idleTimer = 0; - } - } - } - else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) - { - projectile.frame = 13; - projectile.frameCounter = 0; - } - else - { - projectile.frameCounter++; - if (projectile.frameCounter > 5) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 17) - { - projectile.frame = 14; - } - if (projectile.frame < 14) - { - projectile.frame = 14; - } - } + case 3: + if (idleTimer == 0) + { + projectile.frame = 0; + } + ++idleTimer; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 12) + { + chosenIdle = 0; + } + if (projectile.frame < 10) + { + projectile.frame = 10; + } + break; + } + if (chosenIdle == 0) + { + projectile.frame = 0; + projectile.frameCounter = 5; + ++idleTimer; + if (idleTimer > 120) + { + chosenIdle = Main.rand.Next(1, 4); + idleTimer = 0; + } + } + } + else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) + { + projectile.frame = 13; + projectile.frameCounter = 0; + } + else + { + projectile.frameCounter++; + if (projectile.frameCounter > 5) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 17) + { + projectile.frame = 14; + } + if (projectile.frame < 14) + { + projectile.frame = 14; + } + } } else if (fly) { @@ -236,13 +247,30 @@ namespace CalamityMod.Projectiles.Pets float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); float num21 = 18f; float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); - + if (playerDistance > 2000f) { projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); projectile.netUpdate = true; } + if (playerDistance < 100f) + { + num16 = 0.1f; + if (player.velocity.Y == 0f) + { + ++playerStill; + } + else + { + playerStill = 0; + } + if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + fly = false; + projectile.tileCollide = true; + } + } if (playerDistance < 50f) { if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) @@ -252,7 +280,7 @@ namespace CalamityMod.Projectiles.Pets num16 = 0.01f; } else - { + { if (playerDistance < 100f) { num16 = 0.1f; @@ -265,8 +293,8 @@ namespace CalamityMod.Projectiles.Pets horiPos *= playerDistance; vertiPos *= playerDistance; } - - if (projectile.velocity.X < horiPos) + + if (projectile.velocity.X <= horiPos) { projectile.velocity.X = projectile.velocity.X + num16; if (num16 > 0.05f && projectile.velocity.X < 0f) @@ -282,7 +310,7 @@ namespace CalamityMod.Projectiles.Pets projectile.velocity.X = projectile.velocity.X - num16; } } - if (projectile.velocity.Y < vertiPos) + if (projectile.velocity.Y <= vertiPos) { projectile.velocity.Y = projectile.velocity.Y + num16; if (num16 > 0.05f && projectile.velocity.Y < 0f) @@ -298,71 +326,53 @@ namespace CalamityMod.Projectiles.Pets projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; } } - + projectile.rotation = projectile.velocity.X * 0.03f; projectile.frameCounter++; if (projectile.frameCounter > 4) { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 21) - { - projectile.frame = 18; - } - if (projectile.frame < 18) - { - projectile.frame = 18; - } - if (playerDistance < 100f) + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 21) { - num16 = 0.1f; - if(player.velocity.Y == 0f) - { - ++playerStill; - } - else - { - playerStill = 0; - } - if(playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - fly = false; - projectile.tileCollide = true; - projectile.rotation = 0; - } + projectile.frame = 18; + } + if (projectile.frame < 18) + { + projectile.frame = 18; } } if (projectile.velocity.X > 0.25f) - { - projectile.spriteDirection = -1; - } - else if (projectile.velocity.X < -0.25f) - { - projectile.spriteDirection = 1; - } - } - + { + projectile.spriteDirection = -1; + } + else if (projectile.velocity.X < -0.25f) + { + projectile.spriteDirection = 1; + } + } + private bool HoleBelow() //pretty much the same as the one used in mantis - { - int tileWidth = 4; - int tileX = (int)(projectile.Center.X / 16f) - tileWidth; - if (projectile.velocity.X > 0) - { - tileX += tileWidth; - } - int tileY = (int)((projectile.position.Y + projectile.height) / 16f); - for (int y = tileY; y < tileY + 2; y++) - { - for (int x = tileX; x < tileX + tileWidth; x++) - { - if (Main.tile[x, y].active()) - { - return false; - } - } - } - return true; - } - } + { + int tileWidth = 4; + int tileX = (int)(projectile.Center.X / 16f) - tileWidth; + if (projectile.velocity.X > 0) + { + tileX += tileWidth; + } + int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + for (int y = tileY; y < tileY + 2; y++) + { + for (int x = tileX; x < tileX + tileWidth; x++) + { + if (Main.tile[x, y].active()) + { + return false; + } + } + } + return true; + } + } } \ No newline at end of file diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index 02c6a35f15..d33637840b 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -69,9 +69,6 @@ namespace CalamityMod.Projectiles.Pets Microsoft.Xna.Framework.Color color26 = color25; color26 = projectile.GetAlpha(color26); goto IL_6899; - Microsoft.Xna.Framework.Color ff3399 = new Microsoft.Xna.Framework.Color(255, 51, 153, 255); - color26 = Microsoft.Xna.Framework.Color.Lerp(color26, ff3399, 0.5f); - color26.A += (byte)(150); IL_6881: num161 += num158; continue; diff --git a/Projectiles/Pets/ChibiiDoggoFly.cs b/Projectiles/Pets/ChibiiDoggoFly.cs index b804ad5fe7..f808cf5850 100644 --- a/Projectiles/Pets/ChibiiDoggoFly.cs +++ b/Projectiles/Pets/ChibiiDoggoFly.cs @@ -50,18 +50,12 @@ namespace CalamityMod.Projectiles.Pets int num158 = 2; int num159 = 1; float num160 = 0f; - int num161 = num159; while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))) { Microsoft.Xna.Framework.Color color26 = color25; color26 = projectile.GetAlpha(color26); - { - goto IL_6899; - } - Microsoft.Xna.Framework.Color ff3399 = new Microsoft.Xna.Framework.Color(255, 51, 153, 255); - color26 = Microsoft.Xna.Framework.Color.Lerp(color26, ff3399, 0.5f); - color26.A += (byte)(150); + goto IL_6899; IL_6881: num161 += num158; continue; @@ -78,7 +72,6 @@ namespace CalamityMod.Projectiles.Pets Main.spriteBatch.Draw(texture2D3, value4 + projectile.Size / 2f - Main.screenPosition + new Vector2(0, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + projectile.rotation * num160 * (float)(num161 - 1) * projectile.spriteDirection, origin2, projectile.scale, effects, 0f); goto IL_6881; } - Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f); return false; } diff --git a/Projectiles/Pets/DannyDevito.cs b/Projectiles/Pets/DannyDevito.cs index 6b63ff38ef..1d7aad8c0e 100644 --- a/Projectiles/Pets/DannyDevito.cs +++ b/Projectiles/Pets/DannyDevito.cs @@ -34,6 +34,16 @@ namespace CalamityMod.Projectiles.Pets projectile.tileCollide = true; } + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + Player player = Main.player[projectile.owner]; + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + fallThrough = playerDistance > 200f; + return true; + } + public override void AI() { Player player = Main.player[projectile.owner]; @@ -54,6 +64,7 @@ namespace CalamityMod.Projectiles.Pets Vector2 vector46 = projectile.position; if (!fly) { + projectile.rotation = 0; Vector2 center2 = projectile.Center; Vector2 vector48 = player.Center - center2; float playerDistance = vector48.Length(); @@ -157,6 +168,23 @@ namespace CalamityMod.Projectiles.Pets projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); projectile.netUpdate = true; } + if (playerDistance < 100f) + { + num16 = 0.1f; + if (player.velocity.Y == 0f) + { + ++playerStill; + } + else + { + playerStill = 0; + } + if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + fly = false; + projectile.tileCollide = true; + } + } if (playerDistance < 50f) { if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) @@ -179,7 +207,7 @@ namespace CalamityMod.Projectiles.Pets horiPos *= playerDistance; vertiPos *= playerDistance; } - if (projectile.velocity.X < horiPos) + if (projectile.velocity.X <= horiPos) { projectile.velocity.X = projectile.velocity.X + num16; if (num16 > 0.05f && projectile.velocity.X < 0f) @@ -195,7 +223,7 @@ namespace CalamityMod.Projectiles.Pets projectile.velocity.X = projectile.velocity.X - num16; } } - if (projectile.velocity.Y < vertiPos) + if (projectile.velocity.Y <= vertiPos) { projectile.velocity.Y = projectile.velocity.Y + num16; if (num16 > 0.05f && projectile.velocity.Y < 0f) @@ -213,24 +241,6 @@ namespace CalamityMod.Projectiles.Pets } projectile.rotation = projectile.velocity.X * 0.03f; projectile.frame = 7; - if (playerDistance < 100f) - { - num16 = 0.1f; - if (player.velocity.Y == 0f) - { - ++playerStill; - } - else - { - playerStill = 0; - } - if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - fly = false; - projectile.tileCollide = true; - projectile.rotation = 0; - } - } } if (projectile.velocity.X > 0.25f) { diff --git a/Projectiles/Pets/Kendra.cs b/Projectiles/Pets/Kendra.cs new file mode 100644 index 0000000000..9e6b33e0b3 --- /dev/null +++ b/Projectiles/Pets/Kendra.cs @@ -0,0 +1,371 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Pets +{ + public class Kendra : ModProjectile + { + private int chosenIdle = 0; + private int idleTimer = 0; + private int idleBarkTimer = 0; + private int playerStill = 0; + private bool fly = false; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Kendra"); + Main.projFrames[projectile.type] = 31; + Main.projPet[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 56; + projectile.height = 56; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.tileCollide = true; + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough) + { + Player player = Main.player[projectile.owner]; + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + fallThrough = playerDistance > 200f; + return true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (!player.active) + { + projectile.active = false; + return; + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.dead) + { + modPlayer.kendra = false; + } + if (modPlayer.kendra) + { + projectile.timeLeft = 2; + } + Vector2 vector46 = projectile.position; + if (!fly) + { + projectile.rotation = 0; + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2; + float playerDistance = vector48.Length(); + if (projectile.velocity.Y == 0f && (HoleBelow() || (playerDistance > 110f && projectile.position.X == projectile.oldPosition.X))) + { + projectile.velocity.Y = -5f; + } + projectile.velocity.Y += 0.2f; + if (projectile.velocity.Y > 7f) + { + projectile.velocity.Y = 7f; + } + if (playerDistance > 600f) + { + fly = true; + projectile.velocity.X = 0f; + projectile.velocity.Y = 0f; + projectile.tileCollide = false; + } + if (playerDistance > 100f) + { + if (player.position.X - projectile.position.X > 0f) + { + projectile.velocity.X += 0.1f; + if (projectile.velocity.X > 7f) + { + projectile.velocity.X = 7f; + } + } + else + { + projectile.velocity.X -= 0.1f; + if (projectile.velocity.X < -7f) + { + projectile.velocity.X = -7f; + } + } + } + if (playerDistance < 100f) + { + if (projectile.velocity.X != 0f) + { + if (projectile.velocity.X > 0.5f) + { + projectile.velocity.X -= 0.15f; + } + else if (projectile.velocity.X < -0.5f) + { + projectile.velocity.X += 0.15f; + } + else if (projectile.velocity.X < 0.5f && projectile.velocity.X > -0.5f) + { + projectile.velocity.X = 0f; + } + } + } + if (projectile.position.X == projectile.oldPosition.X && projectile.position.Y == projectile.oldPosition.Y && projectile.velocity.X == 0) + { + projectile.frameCounter++; + switch (chosenIdle) + { + case 1: + if (idleTimer == 0) + { + projectile.frame = 0; + } + idleTimer++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 4) + { + chosenIdle = 0; + } + if (projectile.frame < 1) + { + projectile.frame = 1; + } + break; + case 2: + if (idleTimer == 0) + { + projectile.frame = 0; + } + idleTimer++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 13) + { + chosenIdle = 0; + } + if (projectile.frame < 5) + { + projectile.frame = 5; + } + break; + case 3: + if (idleTimer == 0) + { + projectile.frame = 0; + } + idleTimer++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 24) + { + chosenIdle = 0; + } + if (projectile.frame < 19) + { + projectile.frame = 19; + } + break; + } + if (chosenIdle == 0) + { + projectile.frame = 0; + projectile.frameCounter = 6; + idleTimer++; + if (idleTimer > 360) + { + chosenIdle = Main.rand.Next(1, 3); + idleTimer = 0; + } + idleBarkTimer++; + if (idleBarkTimer > 1080 && Main.rand.Next(2) == 0) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/KendraBark"), (int)projectile.position.X, (int)projectile.position.Y); + chosenIdle = 3; + idleBarkTimer = 0; + idleTimer = 0; + } + } + } + else if (projectile.velocity.Y > 0.3f && projectile.position.Y != projectile.oldPosition.Y) + { + projectile.frame = 16; + projectile.frameCounter = 0; + } + else + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 18) + { + projectile.frame = 14; + } + if (projectile.frame < 14) + { + projectile.frame = 14; + } + } + } + else if (fly) + { + float num16 = 0.3f; + projectile.tileCollide = false; + Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float horiPos = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X; + float vertiPos = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y; + vertiPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)Main.rand.Next(-10, 21); + horiPos += (float)(60 * -(float)Main.player[projectile.owner].direction); + vertiPos -= 60f; + float playerDistance = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); + float num21 = 18.5f; + float num27 = (float)Math.Sqrt((double)(horiPos * horiPos + vertiPos * vertiPos)); + if (playerDistance > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (playerDistance < 100f) + { + num16 = 0.1f; + if (player.velocity.Y == 0f) + { + playerStill++; + } + else + { + playerStill = 0; + } + if (playerStill > 60 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + fly = false; + projectile.tileCollide = true; + } + } + if (playerDistance < 50f) + { + if (Math.Abs(projectile.velocity.X) > 2f || Math.Abs(projectile.velocity.Y) > 2f) + { + projectile.velocity *= 0.9f; + } + num16 = 0.01f; + } + else + { + if (playerDistance < 100f) + { + num16 = 0.1f; + } + if (playerDistance > 300f) + { + num16 = 1f; + } + playerDistance = num21 / playerDistance; + horiPos *= playerDistance; + vertiPos *= playerDistance; + } + if (projectile.velocity.X <= horiPos) + { + projectile.velocity.X = projectile.velocity.X + num16; + if (num16 > 0.05f && projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X + num16; + } + } + if (projectile.velocity.X > horiPos) + { + projectile.velocity.X = projectile.velocity.X - num16; + if (num16 > 0.05f && projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X - num16; + } + } + if (projectile.velocity.Y <= vertiPos) + { + projectile.velocity.Y = projectile.velocity.Y + num16; + if (num16 > 0.05f && projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num16 * 2f; + } + } + if (projectile.velocity.Y > vertiPos) + { + projectile.velocity.Y = projectile.velocity.Y - num16; + if (num16 > 0.05f && projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; + } + } + projectile.rotation = projectile.velocity.X * 0.015f; + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 30) + { + projectile.frame = 25; + } + if (projectile.frame < 25) + { + projectile.frame = 25; + } + } + if (projectile.velocity.X > 0.25f) + { + projectile.spriteDirection = -1; + } + else if (projectile.velocity.X < -0.25f) + { + projectile.spriteDirection = 1; + } + } + + private bool HoleBelow() + { + int tileWidth = 4; + int tileX = (int)(projectile.Center.X / 16f) - tileWidth; + if (projectile.velocity.X > 0) + { + tileX += tileWidth; + } + int tileY = (int)((projectile.position.Y + projectile.height) / 16f); + for (int y = tileY; y < tileY + 2; y++) + { + for (int x = tileX; x < tileX + tileWidth; x++) + { + if (Main.tile[x, y].active()) + { + return false; + } + } + } + return true; + } + } +} \ No newline at end of file diff --git a/Projectiles/Pets/Kendra.png b/Projectiles/Pets/Kendra.png new file mode 100644 index 0000000000..554c92d28a Binary files /dev/null and b/Projectiles/Pets/Kendra.png differ diff --git a/Projectiles/Pets/Levi.cs b/Projectiles/Pets/Levi.cs index f6142bee85..675db1e8c5 100644 --- a/Projectiles/Pets/Levi.cs +++ b/Projectiles/Pets/Levi.cs @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Pets projectile.velocity.Y = projectile.velocity.Y - num16 * 2f; } } - if ((double)projectile.velocity.X > 0.25) + if ((double)projectile.velocity.X >= 0.25) { projectile.direction = -1; } @@ -144,7 +144,6 @@ namespace CalamityMod.Projectiles.Pets if (projectile.frame > 4) { projectile.frame = 0; - return; } } } diff --git a/Projectiles/Pets/SirenFlopping.png b/Projectiles/Pets/SirenFlopping.png new file mode 100644 index 0000000000..62bcb652ae Binary files /dev/null and b/Projectiles/Pets/SirenFlopping.png differ diff --git a/Projectiles/Pets/SirenYoung.cs b/Projectiles/Pets/SirenYoung.cs index 6294944271..547456384f 100644 --- a/Projectiles/Pets/SirenYoung.cs +++ b/Projectiles/Pets/SirenYoung.cs @@ -1,210 +1,491 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Pets { - public class SirenYoung : ModProjectile - { - public override void SetStaticDefaults() + public class SirenYoung : ModProjectile + { + private bool underwater = false; + + public override void SetStaticDefaults() { DisplayName.SetDefault("Siren"); - Main.projFrames[projectile.type] = 4; - Main.projPet[projectile.type] = true; - ProjectileID.Sets.LightPet[projectile.type] = true; - } - - public override void SetDefaults() - { - projectile.netImportant = true; - projectile.width = 30; - projectile.height = 30; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.timeLeft *= 5; - projectile.ignoreWater = true; - } + Main.projFrames[projectile.type] = 4; + Main.projPet[projectile.type] = true; + ProjectileID.Sets.LightPet[projectile.type] = true; + } - public override void AI() - { - Player player = Main.player[projectile.owner]; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - if (projectile.localAI[0] == 0f) - { - Lighting.AddLight(projectile.Center, 2.5f, 2f, 0f); //4.5 - } - else - { - Lighting.AddLight(projectile.Center, 1.65f, 1.32f, 0f); //3 - } - } - if (!player.active) - { - projectile.active = false; - return; - } - CalamityPlayer modPlayer = player.GetModPlayer(mod); - if (player.dead) - { - modPlayer.sirenPet = false; - } - if (modPlayer.sirenPet) - { - projectile.timeLeft = 2; - } - float num23 = 0.2f; - float num24 = 5f; - projectile.tileCollide = false; - Vector2 vector4 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num25 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector4.X; - float num26 = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].gfxOffY + (float)(Main.player[projectile.owner].height / 2) - vector4.Y; - if (Main.player[projectile.owner].controlLeft) - { - num25 -= 120f; - } - else if (Main.player[projectile.owner].controlRight) - { - num25 += 120f; - } - if (Main.player[projectile.owner].controlDown) - { - num26 += 120f; - } - else - { - if (Main.player[projectile.owner].controlUp) - { - num26 -= 120f; - } - num26 -= 60f; - } - float num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); - if (num27 > 1000f) - { - projectile.position.X = projectile.position.X + num25; - projectile.position.Y = projectile.position.Y + num26; - } - if (projectile.localAI[0] == 1f) - { - if (num27 < 10f && Math.Abs(Main.player[projectile.owner].velocity.X) + Math.Abs(Main.player[projectile.owner].velocity.Y) < num24 && Main.player[projectile.owner].velocity.Y == 0f) - { - projectile.localAI[0] = 0f; - } - num24 = 12f; - if (num27 < num24) - { - projectile.velocity.X = num25; - projectile.velocity.Y = num26; - } - else - { - num27 = num24 / num27; - projectile.velocity.X = num25 * num27; - projectile.velocity.Y = num26 * num27; - } - if ((double)projectile.velocity.X > 0.5) - { - projectile.direction = -1; - } - else if ((double)projectile.velocity.X < -0.5) - { - projectile.direction = 1; - } - projectile.spriteDirection = projectile.direction; - projectile.rotation = projectile.velocity.X * 0.05f; - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - return; - } - return; - } - if (num27 > 200f) - { - projectile.localAI[0] = 1f; - } - if ((double)projectile.velocity.X > 0.5) - { - projectile.direction = -1; - } - else if ((double)projectile.velocity.X < -0.5) - { - projectile.direction = 1; - } - projectile.spriteDirection = projectile.direction; - if (num27 < 10f) - { - projectile.velocity.X = num25; - projectile.velocity.Y = num26; - projectile.rotation = projectile.velocity.X * 0.05f; - if (num27 < num24) - { - projectile.position += projectile.velocity; - projectile.velocity *= 0f; - num23 = 0f; - } - projectile.direction = -Main.player[projectile.owner].direction; - } - num27 = num24 / num27; - num25 *= num27; - num26 *= num27; - if (projectile.velocity.X < num25) - { - projectile.velocity.X = projectile.velocity.X + num23; - if (projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.99f; - } - } - if (projectile.velocity.X > num25) - { - projectile.velocity.X = projectile.velocity.X - num23; - if (projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X * 0.99f; - } - } - if (projectile.velocity.Y < num26) - { - projectile.velocity.Y = projectile.velocity.Y + num23; - if (projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.99f; - } - } - if (projectile.velocity.Y > num26) - { - projectile.velocity.Y = projectile.velocity.Y - num23; - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y * 0.99f; - } - } - if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) - { - projectile.rotation = projectile.velocity.X * 0.05f; - } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - return; - } - } - } + public override void SetDefaults() + { + projectile.netImportant = true; + projectile.width = 30; + projectile.height = 30; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft *= 5; + projectile.ignoreWater = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + if (!player.active) + { + projectile.active = false; + return; + } + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (player.dead) + { + modPlayer.sirenPet = false; + } + if (modPlayer.sirenPet) + { + projectile.timeLeft = 2; + } + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + underwater = Collision.DrownCollision(player.position, player.width, player.height, player.gravDir); + if (underwater) + { + projectile.width = 30; + projectile.height = 30; + if (projectile.localAI[0] == 0f) + { + Lighting.AddLight(projectile.Center, 2.5f, 2f, 0f); //4.5 + } + else + { + Lighting.AddLight(projectile.Center, 1.65f, 1.32f, 0f); //3 + } + } + else + { + projectile.width = 54; + projectile.height = 54; + Lighting.AddLight(projectile.Center, 0.825f, 0.66f, 0f); //1.5 + Vector2 vector54 = player.Center; + vector54.X -= (float)((15 + player.width / 2) * player.direction); + vector54.X -= (float)(40 * player.direction); + if (projectile.ai[0] == 1f) + { + projectile.tileCollide = false; + float num663 = 0.2f; + float num664 = 10f; + int num665 = 200; + if (num664 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) + { + num664 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); + } + Vector2 vector58 = vector54 - projectile.Center; + float num666 = vector58.Length(); + if (num666 > 2000f) + { + projectile.position = player.Center - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + } + if (num666 < (float)num665 && player.velocity.Y == 0f && projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + if (projectile.velocity.Y < -6f) + { + projectile.velocity.Y = -6f; + } + } + if (num666 >= 60f) + { + vector58.Normalize(); + vector58 *= num664; + if (projectile.velocity.X < vector58.X) + { + projectile.velocity.X = projectile.velocity.X + num663; + if (projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X + num663 * 1.5f; + } + } + if (projectile.velocity.X > vector58.X) + { + projectile.velocity.X = projectile.velocity.X - num663; + if (projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X - num663 * 1.5f; + } + } + if (projectile.velocity.Y < vector58.Y) + { + projectile.velocity.Y = projectile.velocity.Y + num663; + if (projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y + num663 * 1.5f; + } + } + if (projectile.velocity.Y > vector58.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num663; + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y - num663 * 1.5f; + } + } + } + if (projectile.velocity.X != 0f) + { + projectile.spriteDirection = Math.Sign(projectile.velocity.X); + } + } + if (projectile.ai[0] == 2f) + { + projectile.friendly = true; + projectile.spriteDirection = projectile.direction; + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + if (projectile.velocity.Y > 10f) + { + projectile.velocity.Y = 10f; + } + float[] var_2_1C896_cp_0 = projectile.ai; + int var_2_1C896_cp_1 = 1; + float num73 = var_2_1C896_cp_0[var_2_1C896_cp_1]; + var_2_1C896_cp_0[var_2_1C896_cp_1] = num73 - 1f; + if (projectile.ai[1] <= 0f) + { + projectile.ai[1] = 0f; + projectile.ai[0] = 0f; + projectile.friendly = false; + projectile.netUpdate = true; + return; + } + } + if (projectile.ai[0] == 0f) + { + float num671 = 200f; + if (player.rocketDelay2 > 0) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + Vector2 vector59 = vector54 - projectile.Center; + if (vector59.Length() > 2000f) + { + projectile.position = vector54 - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + } + else if (vector59.Length() > num671 || Math.Abs(vector59.Y) > 300f) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + if (projectile.velocity.Y > 0f && vector59.Y < 0f) + { + projectile.velocity.Y = 0f; + } + if (projectile.velocity.Y < 0f && vector59.Y > 0f) + { + projectile.velocity.Y = 0f; + } + } + projectile.tileCollide = true; + float num672 = 0.5f; + float num673 = 4f; + float num674 = 4f; + float num675 = 0.1f; + if (num674 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) + { + num674 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); + num672 = 0.7f; + } + int num676 = 0; + bool flag29 = false; + float num677 = vector54.X - projectile.Center.X; + if (Math.Abs(num677) > 5f) + { + if (num677 < 0f) + { + num676 = -1; + if (projectile.velocity.X > -num673) + { + projectile.velocity.X = projectile.velocity.X - num672; + } + else + { + projectile.velocity.X = projectile.velocity.X - num675; + } + } + else + { + num676 = 1; + if (projectile.velocity.X < num673) + { + projectile.velocity.X = projectile.velocity.X + num672; + } + else + { + projectile.velocity.X = projectile.velocity.X + num675; + } + } + flag29 = true; + } + else + { + projectile.velocity.X = projectile.velocity.X * 0.9f; + if (Math.Abs(projectile.velocity.X) < num672 * 2f) + { + projectile.velocity.X = 0f; + } + } + if (num676 != 0) + { + int num678 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; + int num679 = (int)projectile.position.Y / 16; + num678 += num676; + num678 += (int)projectile.velocity.X; + int num3; + for (int num680 = num679; num680 < num679 + projectile.height / 16 + 1; num680 = num3 + 1) + { + if (WorldGen.SolidTile(num678, num680)) + { + flag29 = true; + } + num3 = num680; + } + } + if (projectile.velocity.X != 0f) + { + flag29 = true; + } + Collision.StepUp(ref projectile.position, ref projectile.velocity, projectile.width, projectile.height, ref projectile.stepSpeed, ref projectile.gfxOffY, 1, false, 0); + if (projectile.velocity.Y == 0f && flag29) + { + int num3; + for (int num681 = 0; num681 < 3; num681 = num3 + 1) + { + int num682 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; + if (num681 == 0) + { + num682 = (int)projectile.position.X / 16; + } + if (num681 == 2) + { + num682 = (int)(projectile.position.X + (float)projectile.width) / 16; + } + int num683 = (int)(projectile.position.Y + (float)projectile.height) / 16; + if (WorldGen.SolidTile(num682, num683) || Main.tile[num682, num683].halfBrick() || Main.tile[num682, num683].slope() > 0 || (TileID.Sets.Platforms[(int)Main.tile[num682, num683].type] && Main.tile[num682, num683].active() && !Main.tile[num682, num683].inActive())) + { + try + { + num682 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; + num683 = (int)(projectile.position.Y + (float)(projectile.height / 2)) / 16; + num682 += num676; + num682 += (int)projectile.velocity.X; + if (!WorldGen.SolidTile(num682, num683 - 1) && !WorldGen.SolidTile(num682, num683 - 2)) + { + projectile.velocity.Y = -5.1f; + } + else if (!WorldGen.SolidTile(num682, num683 - 2)) + { + projectile.velocity.Y = -7.1f; + } + else if (WorldGen.SolidTile(num682, num683 - 5)) + { + projectile.velocity.Y = -11.1f; + } + else if (WorldGen.SolidTile(num682, num683 - 4)) + { + projectile.velocity.Y = -10.1f; + } + else + { + projectile.velocity.Y = -9.1f; + } + } + catch + { + projectile.velocity.Y = -9.1f; + } + } + num3 = num681; + } + } + if (projectile.velocity.X > num674) + { + projectile.velocity.X = num674; + } + if (projectile.velocity.X < -num674) + { + projectile.velocity.X = -num674; + } + if (projectile.velocity.X < 0f) + { + projectile.direction = -1; + } + if (projectile.velocity.X > 0f) + { + projectile.direction = 1; + } + if (projectile.velocity.X > num672 && num676 == 1) + { + projectile.direction = 1; + } + if (projectile.velocity.X < -num672 && num676 == -1) + { + projectile.direction = -1; + } + projectile.spriteDirection = projectile.direction; + projectile.velocity.Y = projectile.velocity.Y + 0.4f; + if (projectile.velocity.Y > 10f) + { + projectile.velocity.Y = 10f; + } + } + return; + } + float num23 = 0.2f; + float num24 = 5f; + projectile.tileCollide = false; + Vector2 vector4 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num25 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector4.X; + float num26 = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].gfxOffY + (float)(Main.player[projectile.owner].height / 2) - vector4.Y; + if (Main.player[projectile.owner].controlLeft) + { + num25 -= 120f; + } + else if (Main.player[projectile.owner].controlRight) + { + num25 += 120f; + } + if (Main.player[projectile.owner].controlDown) + { + num26 += 120f; + } + else + { + if (Main.player[projectile.owner].controlUp) + { + num26 -= 120f; + } + num26 -= 60f; + } + float num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); + if (num27 > 1000f) + { + projectile.position.X = projectile.position.X + num25; + projectile.position.Y = projectile.position.Y + num26; + } + if (projectile.localAI[0] == 1f) + { + if (num27 < 10f && Math.Abs(Main.player[projectile.owner].velocity.X) + Math.Abs(Main.player[projectile.owner].velocity.Y) < num24 && Main.player[projectile.owner].velocity.Y == 0f) + { + projectile.localAI[0] = 0f; + } + num24 = 12f; + if (num27 < num24) + { + projectile.velocity.X = num25; + projectile.velocity.Y = num26; + } + else + { + num27 = num24 / num27; + projectile.velocity.X = num25 * num27; + projectile.velocity.Y = num26 * num27; + } + if ((double)projectile.velocity.X > 0.5) + { + projectile.direction = -1; + } + else if ((double)projectile.velocity.X < -0.5) + { + projectile.direction = 1; + } + projectile.spriteDirection = projectile.direction; + projectile.rotation = projectile.velocity.X * 0.05f; + return; + } + if (num27 > 200f) + { + projectile.localAI[0] = 1f; + } + if ((double)projectile.velocity.X > 0.5) + { + projectile.direction = -1; + } + else if ((double)projectile.velocity.X < -0.5) + { + projectile.direction = 1; + } + projectile.spriteDirection = projectile.direction; + if (num27 < 10f) + { + projectile.velocity.X = num25; + projectile.velocity.Y = num26; + projectile.rotation = projectile.velocity.X * 0.05f; + if (num27 < num24) + { + projectile.position += projectile.velocity; + projectile.velocity *= 0f; + num23 = 0f; + } + projectile.direction = -Main.player[projectile.owner].direction; + } + num27 = num24 / num27; + num25 *= num27; + num26 *= num27; + if (projectile.velocity.X < num25) + { + projectile.velocity.X = projectile.velocity.X + num23; + if (projectile.velocity.X < 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.99f; + } + } + if (projectile.velocity.X > num25) + { + projectile.velocity.X = projectile.velocity.X - num23; + if (projectile.velocity.X > 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.99f; + } + } + if (projectile.velocity.Y < num26) + { + projectile.velocity.Y = projectile.velocity.Y + num23; + if (projectile.velocity.Y < 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.99f; + } + } + if (projectile.velocity.Y > num26) + { + projectile.velocity.Y = projectile.velocity.Y - num23; + if (projectile.velocity.Y > 0f) + { + projectile.velocity.Y = projectile.velocity.Y * 0.99f; + } + } + if (projectile.velocity.X != 0f || projectile.velocity.Y != 0f) + { + projectile.rotation = projectile.velocity.X * 0.05f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = (underwater ? Main.projectileTexture[projectile.type] : mod.GetTexture("Projectiles/Pets/SirenFlopping")); + int num214 = (underwater ? Main.projectileTexture[projectile.type].Height : 256) / Main.projFrames[projectile.type]; + int y6 = num214 * projectile.frame; + Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Ranged/BeeRPG.cs b/Projectiles/Ranged/BeeRPG.cs index fad0f58bfe..7e484be7fc 100644 --- a/Projectiles/Ranged/BeeRPG.cs +++ b/Projectiles/Ranged/BeeRPG.cs @@ -102,6 +102,7 @@ namespace CalamityMod.Projectiles.Ranged num519 += projectile.oldVelocity.Y / 6f; int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 4), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); Main.projectile[num520].penetrate = 2; + Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; } } } diff --git a/Projectiles/Ranged/DrillCannon.png b/Projectiles/Ranged/DrillCannon.png deleted file mode 100644 index 8dc6970475..0000000000 Binary files a/Projectiles/Ranged/DrillCannon.png and /dev/null differ diff --git a/Projectiles/Ranged/FossilShard.png b/Projectiles/Ranged/FossilShard.png index 75ea1cfd83..9af9080d48 100644 Binary files a/Projectiles/Ranged/FossilShard.png and b/Projectiles/Ranged/FossilShard.png differ diff --git a/Projectiles/Ranged/GoliathRocket.cs b/Projectiles/Ranged/GoliathRocket.cs index 7acd09415c..855086e22c 100644 --- a/Projectiles/Ranged/GoliathRocket.cs +++ b/Projectiles/Ranged/GoliathRocket.cs @@ -126,6 +126,7 @@ namespace CalamityMod.Projectiles.Ranged num519 += projectile.oldVelocity.Y / 6f; int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); Main.projectile[num520].penetrate = 2; + Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; } } } diff --git a/Projectiles/Ranged/HiveBomb.cs b/Projectiles/Ranged/HiveBomb.cs index 1e0a8550ab..5aa6171357 100644 --- a/Projectiles/Ranged/HiveBomb.cs +++ b/Projectiles/Ranged/HiveBomb.cs @@ -126,6 +126,7 @@ namespace CalamityMod.Projectiles.Ranged num519 += projectile.oldVelocity.Y / 6f; int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 3), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); Main.projectile[num520].penetrate = 2; + Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; } } } diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 70887d2e59..5c103a501b 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -127,6 +127,7 @@ namespace CalamityMod.Projectiles.Ranged num519 += projectile.oldVelocity.Y / 6f; int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 2), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); Main.projectile[num520].penetrate = 2; + Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; } } } diff --git a/Projectiles/Ranged/HolyFireBullet.cs b/Projectiles/Ranged/HolyFireBullet.cs index f4114d70a8..a4eb8894c8 100644 --- a/Projectiles/Ranged/HolyFireBullet.cs +++ b/Projectiles/Ranged/HolyFireBullet.cs @@ -62,8 +62,9 @@ namespace CalamityMod.Projectiles.Ranged { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, (int)((double)projectile.damage * 0.85), projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, (int)((double)projectile.damage * 0.85), projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceRanged = true; + } for (int k = 0; k < 10; k++) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); diff --git a/Projectiles/Ranged/Norfleet.cs b/Projectiles/Ranged/Norfleet.cs new file mode 100644 index 0000000000..44de90e164 --- /dev/null +++ b/Projectiles/Ranged/Norfleet.cs @@ -0,0 +1,131 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class Norfleet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Norfleet"); + } + + public override void SetDefaults() + { + projectile.width = 140; + projectile.height = 42; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.ai[1]--; + if (projectile.ai[0] >= 0f) + { + projectile.ai[0] += 1f; + switch ((int)projectile.ai[0]) + { + case 90: + case 180: + case 270: + case 360: + case 450: projectile.localAI[0] += 1f; break; + case 540: + projectile.localAI[0] += 1f; + projectile.ai[0] = -1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * 9f; + vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + player.Center; + Vector2 vector7 = vector6 - player.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, (Main.rand.Next(2) == 0 ? 221 : 244), 0f, 0f, 0, default(Color), 4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + break; + } + } + int baseUseTime = 75; + int modifier = 2; + bool timeToFire = false; + if (projectile.ai[1] <= 0f) + { + projectile.ai[1] = baseUseTime - modifier * projectile.localAI[0]; + timeToFire = true; + } + bool canFire = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + if (projectile.soundDelay <= 0 && canFire) + { + projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0]; + if (projectile.ai[0] != 1f) + Main.PlaySound(SoundID.Item92, projectile.position); + } + player.phantasmTime = 2; + if (timeToFire && Main.myPlayer == projectile.owner) + { + if (canFire) + { + int type = 12; + float scaleFactor = 30f; + int damage = player.GetWeaponDamage(player.inventory[player.selectedItem]); + float knockBack = player.inventory[player.selectedItem].knockBack; + for (int i = 0; i < 5; i++) + { + player.PickAmmo(player.inventory[player.selectedItem], ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); + knockBack = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack); + Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); + projectile.velocity = Main.screenPosition - playerPosition; + projectile.velocity.X += Main.mouseX; + projectile.velocity.Y += Main.mouseY; + if (player.gravDir == -1f) + projectile.velocity.Y = (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerPosition.Y; + projectile.velocity.Normalize(); + float variation = (1f + projectile.localAI[0]) * 3f; + Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); + Vector2 speed = projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); + type = mod.ProjectileType("NorfleetComet"); + speed.X = speed.X + (float)Main.rand.Next(-30, 31) * 0.05f; + speed.Y = speed.Y + (float)Main.rand.Next(-30, 31) * 0.05f; + Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); + speed.X = speed.X + (float)Main.rand.Next(-30, 31) * 0.05f; + speed.Y = speed.Y + (float)Main.rand.Next(-30, 31) * 0.05f; + Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); + projectile.netUpdate = true; + } + } + else + { + projectile.Kill(); + } + } + projectile.rotation = projectile.velocity.ToRotation(); + Vector2 displayOffset = new Vector2(32, 0).RotatedBy(projectile.rotation); + projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; + if (projectile.spriteDirection == -1) + projectile.rotation += 3.14159274f; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); + } + + public override bool CanDamage() + { + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Ranged/Norfleet.png b/Projectiles/Ranged/Norfleet.png new file mode 100644 index 0000000000..c38fd3b142 Binary files /dev/null and b/Projectiles/Ranged/Norfleet.png differ diff --git a/Projectiles/Ranged/NorfleetComet.cs b/Projectiles/Ranged/NorfleetComet.cs new file mode 100644 index 0000000000..ce2ae71348 --- /dev/null +++ b/Projectiles/Ranged/NorfleetComet.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class NorfleetComet : ModProjectile + { + public int noTileHitCounter = 120; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Comet"); + } + + public override void SetDefaults() + { + projectile.width = 34; + projectile.height = 34; + projectile.alpha = 255; + projectile.friendly = true; + projectile.ranged = true; + projectile.tileCollide = false; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.ignoreWater = true; + } + + public override void AI() + { + int randomToSubtract = Main.rand.Next(1, 4); + noTileHitCounter -= randomToSubtract; + if (noTileHitCounter == 0) + { + projectile.tileCollide = true; + } + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 20 + Main.rand.Next(40); + if (Main.rand.Next(5) == 0) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9); + } + } + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 18f) + { + projectile.localAI[0] = 0f; + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default(Vector2)) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); + int num9 = Dust.NewDust(projectile.Center, 0, 0, (Main.rand.Next(2) == 0 ? 221 : 244), 0f, 0f, 160, default(Color), 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + projectile.alpha -= 15; + int num58 = 150; + if (projectile.Center.Y >= projectile.ai[1]) + { + num58 = 0; + } + if (projectile.alpha < num58) + { + projectile.alpha = num58; + } + projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + if (Main.rand.Next(16) == 0) + { + Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default(Vector2)); + int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.Next(2) == 0 ? 221 : 244), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); + Main.dust[num59].velocity = value3 * 0.66f; + Main.dust[num59].position = projectile.Center + value3 * 12f; + } + if (projectile.ai[1] == 1f) + { + projectile.light = 0.5f; + if (Main.rand.Next(10) == 0) + { + Dust.NewDust(projectile.position, projectile.width, projectile.height, (Main.rand.Next(2) == 0 ? 221 : 244), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default(Color), 1.2f); + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(Main.DiscoR, 100, 255, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("NorfleetExplosion"), (int)((double)projectile.damage * 0.3), projectile.knockBack * 0.1f, projectile.owner, 0f, 0f); + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 144); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 4; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.Next(2) == 0 ? 221 : 244), 0f, 0f, 50, default(Color), 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.Next(2) == 0 ? 221 : 244), 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.Next(2) == 0 ? 221 : 244), 0f, 0f, 50, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Ranged/NorfleetComet.png b/Projectiles/Ranged/NorfleetComet.png new file mode 100644 index 0000000000..a48c0a7b7a Binary files /dev/null and b/Projectiles/Ranged/NorfleetComet.png differ diff --git a/Projectiles/Ranged/NorfleetExplosion.cs b/Projectiles/Ranged/NorfleetExplosion.cs new file mode 100644 index 0000000000..8b1b03d59f --- /dev/null +++ b/Projectiles/Ranged/NorfleetExplosion.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class NorfleetExplosion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + } + + public override void SetDefaults() + { + projectile.width = 500; + projectile.height = 500; + projectile.friendly = true; + projectile.ignoreWater = false; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 30; + projectile.ranged = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.75f) / 255f, ((255 - projectile.alpha) * 0.5f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-120, 121); + float num464 = (float)Main.rand.Next(-120, 121); + float num465 = (float)Main.rand.Next(36, 108); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (Main.rand.Next(2) == 0 ? 221 : 244), 0f, 0f, 100, default(Color), 2f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Ranged/NorfleetExplosion.png b/Projectiles/Ranged/NorfleetExplosion.png new file mode 100644 index 0000000000..3cb685553d Binary files /dev/null and b/Projectiles/Ranged/NorfleetExplosion.png differ diff --git a/Projectiles/Ranged/OnyxSharkBomb.cs b/Projectiles/Ranged/OnyxSharkBomb.cs index ca1e3509b3..fbba5aae64 100644 --- a/Projectiles/Ranged/OnyxSharkBomb.cs +++ b/Projectiles/Ranged/OnyxSharkBomb.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -49,6 +50,13 @@ namespace CalamityMod.Projectiles.Ranged } } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + public override void Kill(int timeLeft) { for (int k = 0; k < 10; k++) diff --git a/Projectiles/Ranged/OnyxSharkBomb.png b/Projectiles/Ranged/OnyxSharkBomb.png index 9c23e79a0a..9e84597ac9 100644 Binary files a/Projectiles/Ranged/OnyxSharkBomb.png and b/Projectiles/Ranged/OnyxSharkBomb.png differ diff --git a/Projectiles/Ranged/PlagueArrow.cs b/Projectiles/Ranged/PlagueArrow.cs index 869c3afd76..e4dceabd99 100644 --- a/Projectiles/Ranged/PlagueArrow.cs +++ b/Projectiles/Ranged/PlagueArrow.cs @@ -46,8 +46,7 @@ namespace CalamityMod.Projectiles.Ranged num518 += projectile.oldVelocity.X / 6f; num519 += projectile.oldVelocity.Y / 6f; int num520 = Projectile.NewProjectile(value20.X, value20.Y, num518, num519, Main.player[projectile.owner].beeType(), Main.player[projectile.owner].beeDamage(projectile.damage / 2), Main.player[projectile.owner].beeKB(0f), Main.myPlayer, 0f, 0f); - Main.projectile[num520].magic = false; - Main.projectile[num520].ranged = true; + Main.projectile[num520].GetGlobalProjectile(mod).forceRanged = true; Main.projectile[num520].penetrate = 2; } } diff --git a/Projectiles/Ranged/RealmRavagerBullet.cs b/Projectiles/Ranged/RealmRavagerBullet.cs new file mode 100644 index 0000000000..05e22401d6 --- /dev/null +++ b/Projectiles/Ranged/RealmRavagerBullet.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class RealmRavagerBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosive Bullet"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.ranged = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = 242; + projectile.penetrate = 1; + projectile.timeLeft = 90; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + projectile.position = projectile.Center; + projectile.width = (projectile.height = 32); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 0, default(Color), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + projectile.Damage(); + } + } +} \ No newline at end of file diff --git a/Projectiles/Ranged/RealmRavagerBullet.png b/Projectiles/Ranged/RealmRavagerBullet.png new file mode 100644 index 0000000000..ef327144f8 Binary files /dev/null and b/Projectiles/Ranged/RealmRavagerBullet.png differ diff --git a/Projectiles/Ranged/SandyWaifuShark.cs b/Projectiles/Ranged/SandyWaifuShark.cs index 54404d5af2..bc2043949f 100644 --- a/Projectiles/Ranged/SandyWaifuShark.cs +++ b/Projectiles/Ranged/SandyWaifuShark.cs @@ -13,13 +13,13 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { DisplayName.SetDefault("Shark"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 8; } public override void SetDefaults() { - projectile.width = 120; - projectile.height = 40; + projectile.width = 60; + projectile.height = 60; projectile.scale = 0.7f; projectile.friendly = true; projectile.ranged = true; @@ -54,12 +54,12 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[num192].velocity *= 0.2f; Main.dust[num192].position = (Main.dust[num192].position + projectile.Center) / 2f; projectile.frameCounter++; - if (projectile.frameCounter > 8) + if (projectile.frameCounter > 6) { projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (projectile.frame > 7) { projectile.frame = 0; } diff --git a/Projectiles/Ranged/SandyWaifuShark.png b/Projectiles/Ranged/SandyWaifuShark.png index a2b91920ae..59d1097a8d 100644 Binary files a/Projectiles/Ranged/SandyWaifuShark.png and b/Projectiles/Ranged/SandyWaifuShark.png differ diff --git a/Projectiles/Magic/StarfleetMK2.cs b/Projectiles/Ranged/StarfleetMK2.cs similarity index 88% rename from Projectiles/Magic/StarfleetMK2.cs rename to Projectiles/Ranged/StarfleetMK2.cs index a2ddc706ba..f8665e4b1c 100644 --- a/Projectiles/Magic/StarfleetMK2.cs +++ b/Projectiles/Ranged/StarfleetMK2.cs @@ -1,140 +1,138 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class StarfleetMK2 : ModProjectile - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Starmada"); - } - - public override void SetDefaults() - { - projectile.width = 98; - projectile.height = 32; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; - } - - public override void AI() - { - Lighting.AddLight(projectile.Center, 32f / 255f, 208f / 255f, 255f / 255f); - Player player = Main.player[projectile.owner]; - projectile.ai[1]--; - if (projectile.ai[0] >= 0f) - { - projectile.ai[0] += 1f; - switch ((int)projectile.ai[0]) - { - case 90: - case 180: - case 270: - case 360: - case 450: projectile.localAI[0] += 1f; break; - case 540: - projectile.localAI[0] += 1f; - projectile.ai[0] = -1f; - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * 9f; - vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + player.Center; - Vector2 vector7 = vector6 - player.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 221, 0f, 0f, 0, default(Color), 4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].velocity = vector7; - } - break; - } - } - int baseUseTime = 27; - int modifier = 2; - bool timeToFire = false; - if (projectile.ai[1] <= 0f) - { - projectile.ai[1] = baseUseTime - modifier * projectile.localAI[0]; - timeToFire = true; - } - bool canFire = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; - if (projectile.soundDelay <= 0 && canFire) - { - projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0]; - if (projectile.ai[0] != 1f) - Main.PlaySound(SoundID.Item92, projectile.position); - } - player.phantasmTime = 2; - if (timeToFire && Main.myPlayer == projectile.owner) - { - if (canFire) - { - int type = 12; - float scaleFactor = 16f; - int damage = player.GetWeaponDamage(player.inventory[player.selectedItem]); - float knockBack = player.inventory[player.selectedItem].knockBack; - player.PickAmmo(player.inventory[player.selectedItem], ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); - for (int i = 0; i < 5; i++) - { - knockBack = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack); - Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); - projectile.velocity = Main.screenPosition - playerPosition; - projectile.velocity.X += Main.mouseX; - projectile.velocity.Y += Main.mouseY; - if (player.gravDir == -1f) - projectile.velocity.Y = (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerPosition.Y; - projectile.velocity.Normalize(); - float variation = (1f + projectile.localAI[0]) * 3f; - Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); - Vector2 speed = projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); - switch (Main.rand.Next(5)) - { - case 0: type = mod.ProjectileType("PlasmaBlast"); break; - case 1: type = mod.ProjectileType("AstralStar"); break; - case 2: type = mod.ProjectileType("GalacticaComet"); break; - case 3: break; - case 4: type = 9; break; - } - int star = Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); - Main.projectile[star].penetrate = 1; - Main.projectile[star].timeLeft = 300; - Main.projectile[star].ranged = true; - Main.projectile[star].magic = false; - Main.projectile[star].melee = false; - Main.projectile[star].netUpdate = true; - projectile.netUpdate = true; - } - } - else - { - projectile.Kill(); - } - } - projectile.rotation = projectile.velocity.ToRotation(); - Vector2 displayOffset = new Vector2(32, 0).RotatedBy(projectile.rotation); - projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; - if (projectile.spriteDirection == -1) - projectile.rotation += 3.14159274f; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 2; - player.ChangeDir(projectile.direction); - player.heldProj = projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); - } - - public override bool CanDamage() - { - return false; - } - } +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class StarfleetMK2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Starmada"); + } + + public override void SetDefaults() + { + projectile.width = 122; + projectile.height = 50; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 32f / 255f, 208f / 255f, 255f / 255f); + Player player = Main.player[projectile.owner]; + projectile.ai[1]--; + if (projectile.ai[0] >= 0f) + { + projectile.ai[0] += 1f; + switch ((int)projectile.ai[0]) + { + case 90: + case 180: + case 270: + case 360: + case 450: projectile.localAI[0] += 1f; break; + case 540: + projectile.localAI[0] += 1f; + projectile.ai[0] = -1f; + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * 9f; + vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + player.Center; + Vector2 vector7 = vector6 - player.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 221, 0f, 0f, 0, default(Color), 4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + break; + } + } + int baseUseTime = 27; + int modifier = 2; + bool timeToFire = false; + if (projectile.ai[1] <= 0f) + { + projectile.ai[1] = baseUseTime - modifier * projectile.localAI[0]; + timeToFire = true; + } + bool canFire = player.channel && player.HasAmmo(player.inventory[player.selectedItem], true) && !player.noItems && !player.CCed; + if (projectile.soundDelay <= 0 && canFire) + { + projectile.soundDelay = baseUseTime - modifier * (int)projectile.localAI[0]; + if (projectile.ai[0] != 1f) + Main.PlaySound(SoundID.Item92, projectile.position); + } + player.phantasmTime = 2; + if (timeToFire && Main.myPlayer == projectile.owner) + { + if (canFire) + { + int type = 12; + float scaleFactor = 16f; + int damage = player.GetWeaponDamage(player.inventory[player.selectedItem]); + float knockBack = player.inventory[player.selectedItem].knockBack; + player.PickAmmo(player.inventory[player.selectedItem], ref type, ref scaleFactor, ref canFire, ref damage, ref knockBack, false); + for (int i = 0; i < 5; i++) + { + knockBack = player.GetWeaponKnockback(player.inventory[player.selectedItem], knockBack); + Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); + projectile.velocity = Main.screenPosition - playerPosition; + projectile.velocity.X += Main.mouseX; + projectile.velocity.Y += Main.mouseY; + if (player.gravDir == -1f) + projectile.velocity.Y = (Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - playerPosition.Y; + projectile.velocity.Normalize(); + float variation = (1f + projectile.localAI[0]) * 3f; + Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); + Vector2 speed = projectile.velocity * scaleFactor * (0.6f + Main.rand.NextFloat() * 0.6f); + switch (Main.rand.Next(5)) + { + case 0: type = mod.ProjectileType("PlasmaBlast"); break; + case 1: type = mod.ProjectileType("AstralStar"); break; + case 2: type = mod.ProjectileType("GalacticaComet"); break; + case 3: break; + case 4: type = 9; break; + } + int star = Projectile.NewProjectile(position, speed, type, damage, knockBack, projectile.owner, 0f, 0f); + Main.projectile[star].penetrate = 1; + Main.projectile[star].timeLeft = 300; + Main.projectile[star].GetGlobalProjectile(mod).forceRanged = true; + Main.projectile[star].netUpdate = true; + projectile.netUpdate = true; + } + } + else + { + projectile.Kill(); + } + } + projectile.rotation = projectile.velocity.ToRotation(); + Vector2 displayOffset = new Vector2(32, 0).RotatedBy(projectile.rotation); + projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; + if (projectile.spriteDirection == -1) + projectile.rotation += 3.14159274f; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * projectile.direction, projectile.velocity.X * projectile.direction); + } + + public override bool CanDamage() + { + return false; + } + } } \ No newline at end of file diff --git a/Projectiles/Ranged/StarfleetMK2.png b/Projectiles/Ranged/StarfleetMK2.png new file mode 100644 index 0000000000..3cef0ffadf Binary files /dev/null and b/Projectiles/Ranged/StarfleetMK2.png differ diff --git a/Projectiles/Ranged/WaterSpout.cs b/Projectiles/Ranged/WaterSpout.cs index f52968e455..1f42e0f379 100644 --- a/Projectiles/Ranged/WaterSpout.cs +++ b/Projectiles/Ranged/WaterSpout.cs @@ -7,33 +7,33 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class WaterSpout : ModProjectile - { - public override void SetStaticDefaults() + public class WaterSpout : ModProjectile + { + public override void SetStaticDefaults() { DisplayName.SetDefault("Spout"); Main.projFrames[projectile.type] = 6; } - - public override void SetDefaults() - { - projectile.width = 150; - projectile.height = 42; - projectile.scale = 0.6f; - projectile.friendly = true; - projectile.tileCollide = false; - projectile.ignoreWater = true; - projectile.ranged = true; - projectile.penetrate = -1; - projectile.alpha = 255; - projectile.timeLeft = 60; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; - } - - public override void AI() - { - int num613 = 10; + + public override void SetDefaults() + { + projectile.width = 150; + projectile.height = 42; + projectile.scale = 0.6f; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.ranged = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.timeLeft = 60; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + int num613 = 10; int num614 = 15; float num615 = 1f; int num616 = 150; @@ -111,15 +111,15 @@ namespace CalamityMod.Projectiles.Ranged projectile.position.X = projectile.position.X + num624 * (float)(-(float)projectile.direction); return; } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture2D13 = Main.projectileTexture[projectile.type]; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture2D13 = Main.projectileTexture[projectile.type]; int num214 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y6 = num214 * projectile.frame; Main.spriteBatch.Draw(texture2D13, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y6, texture2D13.Width, num214)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), projectile.scale, SpriteEffects.None, 0f); return false; - } - } + } + } } \ No newline at end of file diff --git a/Projectiles/Rogue/AccretionDisk2.cs b/Projectiles/Rogue/AccretionDisk2.cs index efe6407241..9b95af0fc1 100644 --- a/Projectiles/Rogue/AccretionDisk2.cs +++ b/Projectiles/Rogue/AccretionDisk2.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (Main.rand.Next(2) == 0) + if (Main.rand.Next(10) == 0) { int num250 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 66, (float)(projectile.direction * 2), 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 0.5f); Main.dust[num250].noGravity = true; diff --git a/Projectiles/Rogue/CraniumSmasher.cs b/Projectiles/Rogue/CraniumSmasher.cs new file mode 100644 index 0000000000..87f93872a6 --- /dev/null +++ b/Projectiles/Rogue/CraniumSmasher.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class CraniumSmasher : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Cranium Smasher"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.penetrate = 5; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + projectile.tileCollide = false; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 3f) + { + projectile.tileCollide = true; + } + projectile.rotation += projectile.velocity.X * 0.02f; + projectile.velocity.Y = projectile.velocity.Y + 0.085f; + projectile.velocity.X = projectile.velocity.X * 0.99f; + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 5; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, (projectile.oldVelocity.X / 2), (projectile.oldVelocity.Y / 2), 0, default(Color), 2f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, (projectile.oldVelocity.X / 2), (projectile.oldVelocity.Y / 2), 0, default(Color), 1f); + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/CraniumSmasher.png b/Projectiles/Rogue/CraniumSmasher.png new file mode 100644 index 0000000000..ee328a69cc Binary files /dev/null and b/Projectiles/Rogue/CraniumSmasher.png differ diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.cs b/Projectiles/Rogue/CraniumSmasherExplosive.cs new file mode 100644 index 0000000000..75e3cd8eb2 --- /dev/null +++ b/Projectiles/Rogue/CraniumSmasherExplosive.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class CraniumSmasherExplosive : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosive Cranium Smasher"); + } + + public override void SetDefaults() + { + projectile.width = 50; + projectile.height = 50; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.localNPCHitCooldown = 15; + projectile.tileCollide = false; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 5f) + { + projectile.tileCollide = true; + } + projectile.rotation += projectile.velocity.X * 0.02f; + projectile.velocity.Y = projectile.velocity.Y + 0.085f; + projectile.velocity.X = projectile.velocity.X * 0.99f; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14); + for (int num625 = 0; num625 < 3; 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(Vector2), Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13AB6_cp_0 = Main.gore[num626]; + expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f; + Gore expr_13AD6_cp_0 = Main.gore[num626]; + expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.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(Vector2), Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13B79_cp_0 = Main.gore[num626]; + expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f; + Gore expr_13B99_cp_0 = Main.gore[num626]; + expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.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(Vector2), Main.rand.Next(61, 64), 1f); + Main.gore[num626].velocity *= scaleFactor10; + Gore expr_13C3C_cp_0 = Main.gore[num626]; + expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f; + Gore expr_13C5C_cp_0 = Main.gore[num626]; + expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f; + } + projectile.width = 200; + projectile.height = 200; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num194 = 0; num194 < 25; num194++) + { + int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 135, 0f, 0f, 100, default(Color), 2f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 0f; + } + projectile.Damage(); + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.png b/Projectiles/Rogue/CraniumSmasherExplosive.png new file mode 100644 index 0000000000..22f58653e6 Binary files /dev/null and b/Projectiles/Rogue/CraniumSmasherExplosive.png differ diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index 91b4550779..92f99ddbc4 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 38; - projectile.height = 38; + projectile.width = 34; + projectile.height = 34; projectile.friendly = true; projectile.penetrate = 2; projectile.aiStyle = 2; diff --git a/Projectiles/Rogue/Crushax.png b/Projectiles/Rogue/Crushax.png index c90de40872..366f6ad0a8 100644 Binary files a/Projectiles/Rogue/Crushax.png and b/Projectiles/Rogue/Crushax.png differ diff --git a/Projectiles/Rogue/EmpyreanKnives.png b/Projectiles/Rogue/EmpyreanKnives.png index 09b796a5aa..85f20bfa03 100644 Binary files a/Projectiles/Rogue/EmpyreanKnives.png and b/Projectiles/Rogue/EmpyreanKnives.png differ diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index 496e898f0e..972063c772 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 24; - projectile.height = 44; + projectile.width = 58; + projectile.height = 58; projectile.friendly = true; projectile.tileCollide = false; projectile.penetrate = -1; @@ -78,8 +78,9 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 2f, 0f); - } + int proj = Projectile.NewProjectile(value10.X, value10.Y, num438, num439, mod.ProjectileType("NebulaShot"), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; + } } } } diff --git a/Projectiles/Rogue/FlameScytheProjectile.cs b/Projectiles/Rogue/FlameScytheProjectile.cs index f9483df47f..57c7dab936 100644 --- a/Projectiles/Rogue/FlameScytheProjectile.cs +++ b/Projectiles/Rogue/FlameScytheProjectile.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 50; - projectile.height = 50; + projectile.width = 34; + projectile.height = 34; projectile.friendly = true; projectile.penetrate = -1; projectile.aiStyle = 3; @@ -66,8 +66,9 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(BuffID.Bleeding, 600); if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; + } } } } \ No newline at end of file diff --git a/Projectiles/Rogue/FossilShardThrown.png b/Projectiles/Rogue/FossilShardThrown.png index 75ea1cfd83..81b7a03b84 100644 Binary files a/Projectiles/Rogue/FossilShardThrown.png and b/Projectiles/Rogue/FossilShardThrown.png differ diff --git a/Projectiles/Rogue/IceStarProjectile.cs b/Projectiles/Rogue/IceStarProjectile.cs index 8bcbfc3c8a..6b5408f6fe 100644 --- a/Projectiles/Rogue/IceStarProjectile.cs +++ b/Projectiles/Rogue/IceStarProjectile.cs @@ -7,33 +7,33 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class IceStarProjectile : ModProjectile - { - public override void SetStaticDefaults() + public class IceStarProjectile : ModProjectile + { + public override void SetStaticDefaults() { DisplayName.SetDefault("Star"); } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.aiStyle = 2; - projectile.timeLeft = 280; - aiType = 48; + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.aiStyle = 2; + projectile.timeLeft = 280; + aiType = 48; projectile.GetGlobalProjectile(mod).rogue = true; } - - public override void AI() - { - projectile.rotation += 0.5f; - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - float num472 = projectile.Center.X; + + public override void AI() + { + projectile.rotation += 0.5f; + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + float num472 = projectile.Center.X; float num473 = projectile.Center.Y; float num474 = 400f; bool flag17 = false; @@ -65,24 +65,23 @@ namespace CalamityMod.Projectiles.Rogue num485 *= num486; projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } + } - public override void Kill(int timeLeft) - { - Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); - for (int k = 0; k < 5; k++) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); - } - } - } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + } } \ No newline at end of file diff --git a/Projectiles/Rogue/IchorSpear2.cs b/Projectiles/Rogue/IchorSpear2.cs new file mode 100644 index 0000000000..b523ce8eb5 --- /dev/null +++ b/Projectiles/Rogue/IchorSpear2.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class IchorSpear2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + if (Main.rand.Next(4) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 300f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + 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) + { + projectile.extraUpdates = 2; + float num483 = 12f; + 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 bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i <= 10; i++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 246, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Ichor, 120); + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/IchorSpear2.png b/Projectiles/Rogue/IchorSpear2.png new file mode 100644 index 0000000000..52f7eefcf4 Binary files /dev/null and b/Projectiles/Rogue/IchorSpear2.png differ diff --git a/Projectiles/Rogue/OPHammer.cs b/Projectiles/Rogue/OPHammer.cs index d9e711ffbb..9d01f764c0 100644 --- a/Projectiles/Rogue/OPHammer.cs +++ b/Projectiles/Rogue/OPHammer.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 38; - projectile.height = 38; + projectile.width = 62; + projectile.height = 62; projectile.friendly = true; projectile.tileCollide = false; projectile.penetrate = -1; @@ -115,8 +115,9 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(mod.BuffType("BrimstoneFlames"), 300); if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - } + int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, 612, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[proj].GetGlobalProjectile(mod).forceRogue = true; + } } } } \ No newline at end of file diff --git a/Projectiles/Rogue/RoyalKnife.png b/Projectiles/Rogue/RoyalKnife.png index 0ee108a711..d8793dd624 100644 Binary files a/Projectiles/Rogue/RoyalKnife.png and b/Projectiles/Rogue/RoyalKnife.png differ diff --git a/Projectiles/Rogue/ScarletBlast.cs b/Projectiles/Rogue/ScarletBlast.cs new file mode 100644 index 0000000000..5fdc070935 --- /dev/null +++ b/Projectiles/Rogue/ScarletBlast.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ScarletBlast : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blast"); + } + + public override void SetDefaults() + { + projectile.width = 500; + projectile.height = 500; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 30; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 1; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.55f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + bool flag15 = false; + bool flag16 = false; + if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) + { + flag15 = true; + } + if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) + { + flag16 = true; + } + if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) + { + flag16 = true; + } + if (flag15 && flag16) + { + projectile.Kill(); + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-30, 35); + float num464 = (float)Main.rand.Next(-30, 35); + float num465 = (float)Main.rand.Next(13, 18); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 130, 0f, 0f, 100, default(Color), 1.25f); + Main.dust[num467].noGravity = true; + Main.dust[num467].position.X = projectile.Center.X; + Main.dust[num467].position.Y = projectile.Center.Y; + Dust expr_149DF_cp_0 = Main.dust[num467]; + expr_149DF_cp_0.position.X = expr_149DF_cp_0.position.X + (float)Main.rand.Next(-10, 11); + Dust expr_14A09_cp_0 = Main.dust[num467]; + expr_14A09_cp_0.position.Y = expr_14A09_cp_0.position.Y + (float)Main.rand.Next(-10, 11); + Main.dust[num467].velocity.X = num463; + Main.dust[num467].velocity.Y = num464; + num462++; + } + return; + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/ScarletBlast.png b/Projectiles/Rogue/ScarletBlast.png new file mode 100644 index 0000000000..cbdfcfe589 Binary files /dev/null and b/Projectiles/Rogue/ScarletBlast.png differ diff --git a/Projectiles/Rogue/ScarletDevilBullet.cs b/Projectiles/Rogue/ScarletDevilBullet.cs new file mode 100644 index 0000000000..1460dd0345 --- /dev/null +++ b/Projectiles/Rogue/ScarletDevilBullet.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ScarletDevilBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gungnir Bullet"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.timeLeft = 140; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.ai[0] += 1f; + if (projectile.ai[0] <= 60f) + { + projectile.velocity.X *= 0.975f; + projectile.velocity.Y *= 0.975f; + } + else + { + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 1000f; + bool homeIn = false; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].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; + centerX = num476; + centerY = num477; + homeIn = true; + } + } + } + if (homeIn) + { + float num483 = 30f; + Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); + float num484 = centerX - vector35.X; + float num485 = centerY - 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 * 10f + num484) / 11f; + projectile.velocity.Y = (projectile.velocity.Y * 10f + num485) / 11f; + return; + } + else + { + projectile.velocity.X = 0f; + projectile.velocity.Y = 0f; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + CalamityPlayer modPlayer = Main.player[Main.myPlayer].GetModPlayer(mod); + if (target.type == NPCID.TargetDummy || modPlayer.rogueStealth <= 0f) + { + return; + } + Main.player[Main.myPlayer].statLife += 1; + Main.player[Main.myPlayer].HealEffect(1); + } + } +} diff --git a/Projectiles/Rogue/ScarletDevilBullet.png b/Projectiles/Rogue/ScarletDevilBullet.png new file mode 100644 index 0000000000..1aa28b9d93 Binary files /dev/null and b/Projectiles/Rogue/ScarletDevilBullet.png differ diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs new file mode 100644 index 0000000000..278d71ec4a --- /dev/null +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Terraria.GameContent.Achievements; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ScarletDevilProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spear the Gungnir"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 95; + projectile.height = 95; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.timeLeft = 420; + projectile.extraUpdates = 1; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.55f) / 255f, ((100 - projectile.alpha) * 0.25f) / 255f, ((100 - projectile.alpha) * 0.01f) / 255f); + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 130, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.85f); + projectile.ai[0] += 1f; + if (projectile.ai[0] >= 5f) + { + int numProj = 2; + float rotation = MathHelper.ToRadians(15); + if (projectile.owner == Main.myPlayer) + { + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = new Vector2(-projectile.velocity.X / 3, -projectile.velocity.Y / 3).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + for(int j = 0; j < 2; j++) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("ScarletDevilBullet"), (int)((double)projectile.damage * 0.03), 0f, projectile.owner, 0f, 0f); + perturbedSpeed *= 1.05f; + } + } + } + projectile.ai[0] = 0f; + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(250, 250, 250); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item122, projectile.position); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 150); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("ScarletBlast"), (int)((double)projectile.damage * 0.0075), 0f, projectile.owner, 0f, 0f); + CalamityPlayer modPlayer = Main.player[Main.myPlayer].GetModPlayer(mod); + if (target.type == NPCID.TargetDummy || modPlayer.rogueStealth <= 0f) + { + return; + } + Main.player[Main.myPlayer].statLife += 12; + Main.player[Main.myPlayer].HealEffect(12); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int i = 0; i < projectile.oldPos.Length; i++) + { + Texture2D trail = mod.GetTexture("Projectiles/Rogue/ScarletDevilProjectile"); + lightColor = new Color(100, 100, 100); + Vector2 drawPos = projectile.oldPos[i] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - i) / (float)projectile.oldPos.Length); + spriteBatch.Draw(trail, drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/ScarletDevilProjectile.png b/Projectiles/Rogue/ScarletDevilProjectile.png new file mode 100644 index 0000000000..b5748ead84 Binary files /dev/null and b/Projectiles/Rogue/ScarletDevilProjectile.png differ diff --git a/Projectiles/Rogue/ScourgeoftheDesert2.cs b/Projectiles/Rogue/ScourgeoftheDesert2.cs new file mode 100644 index 0000000000..00b72b222c --- /dev/null +++ b/Projectiles/Rogue/ScourgeoftheDesert2.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ScourgeoftheDesert2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scourge"); + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.penetrate = 6; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 20f) + { + if (projectile.velocity.Y < 24f) + { + projectile.velocity.Y += 0.4f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/ScourgeoftheDesert2.png b/Projectiles/Rogue/ScourgeoftheDesert2.png new file mode 100644 index 0000000000..a000180d87 Binary files /dev/null and b/Projectiles/Rogue/ScourgeoftheDesert2.png differ diff --git a/Projectiles/Rogue/SpearofPaleolith.png b/Projectiles/Rogue/SpearofPaleolith.png index e1b80c6db9..44a2ad2834 100644 Binary files a/Projectiles/Rogue/SpearofPaleolith.png and b/Projectiles/Rogue/SpearofPaleolith.png differ diff --git a/Projectiles/Rogue/Valediction2.cs b/Projectiles/Rogue/Valediction2.cs new file mode 100644 index 0000000000..b25c00edb4 --- /dev/null +++ b/Projectiles/Rogue/Valediction2.cs @@ -0,0 +1,209 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class Valediction2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Scythe"); + } + + public override void SetDefaults() + { + projectile.width = 70; + projectile.height = 70; + projectile.friendly = true; + projectile.tileCollide = false; + projectile.penetrate = 12; + projectile.extraUpdates = 3; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + if (projectile.soundDelay == 0) + { + projectile.soundDelay = 8; + Main.PlaySound(SoundID.Item7, projectile.position); + } + if (projectile.localAI[0] == 0f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] >= 60f) + { + projectile.localAI[0] = 1f; + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + else + { + float num472 = projectile.Center.X; + float num473 = projectile.Center.Y; + float num474 = 400f; + bool flag17 = false; + for (int num475 = 0; num475 < 200; num475++) + { + if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + { + 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 = 20f; + 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; + } + } + } + else + { + float num633 = 700f; + bool flag24 = false; + if (projectile.ai[0] == 1f) + { + projectile.ai[1] += 1f; + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (!flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 8f; + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 1f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 8f; + projectile.netUpdate = true; + } + } + } + } + projectile.rotation += 0.5f; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(mod.BuffType("CrushDepth"), 600); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 21); + projectile.position.X = projectile.position.X + (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2); + projectile.width = 100; + projectile.height = 100; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.Next(2) == 0) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 8; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 33, 0f, 0f, 100, default(Color), 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, 33, 0f, 0f, 100, default(Color), 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Rogue/Valediction2.png b/Projectiles/Rogue/Valediction2.png new file mode 100644 index 0000000000..1c3cefaf35 Binary files /dev/null and b/Projectiles/Rogue/Valediction2.png differ diff --git a/Projectiles/Rogue/XerocPitchforkProjectile.cs b/Projectiles/Rogue/XerocPitchforkProjectile.cs index 65dcf5ce13..fd31de0e2e 100644 --- a/Projectiles/Rogue/XerocPitchforkProjectile.cs +++ b/Projectiles/Rogue/XerocPitchforkProjectile.cs @@ -8,58 +8,59 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - public class XerocPitchforkProjectile : ModProjectile - { - public override void SetStaticDefaults() + public class XerocPitchforkProjectile : ModProjectile + { + public override void SetStaticDefaults() { DisplayName.SetDefault("Pitchfork"); } - - public override void SetDefaults() - { - projectile.width = 14; - projectile.height = 14; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.extraUpdates = 1; - projectile.aiStyle = 113; - projectile.timeLeft = 600; - aiType = 598; + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + projectile.aiStyle = 113; + projectile.timeLeft = 600; + aiType = 598; projectile.GetGlobalProjectile(mod).rogue = true; } - - public override void AI() - { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if (Main.rand.Next(3) == 0) - { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } - if(projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D tex = Main.projectileTexture[projectile.type]; - spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); - return false; - } - - public override void Kill(int timeLeft) - { - if (Main.rand.Next(2) == 0) - { - Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("XerocPitchfork")); - } - } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.immune[projectile.owner] = 2; + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + if (Main.rand.Next(3) == 0) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + if (projectile.spriteDirection == -1) + { + projectile.rotation -= 1.57f; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void Kill(int timeLeft) + { + if (Main.rand.Next(2) == 0) + { + Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("XerocPitchfork")); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.damage /= 2; + target.immune[projectile.owner] = 2; target.AddBuff(BuffID.CursedInferno, 500); - } - } + } + } } \ No newline at end of file diff --git a/Projectiles/Shrines/GladiatorSword.cs b/Projectiles/Shrines/GladiatorSword.cs new file mode 100644 index 0000000000..7dff13a043 --- /dev/null +++ b/Projectiles/Shrines/GladiatorSword.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Shrines +{ + public class GladiatorSword : ModProjectile + { + private double rotation = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gladiator Sword"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 22; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.timeLeft *= 5; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("GladiatorSword"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.gladiatorSword) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.glSword = false; + } + if (modPlayer.glSword) + { + projectile.timeLeft = 2; + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + Vector2 vector = player.Center - projectile.Center; + projectile.rotation = vector.ToRotation() - 1.57f; + projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); + rotation += 0.03; + if (rotation >= 360) + { + rotation = 0; + } + projectile.velocity.X = ((vector.X > 0f) ? -0.000001f : 0f); + } + } +} \ No newline at end of file diff --git a/Projectiles/Shrines/GladiatorSword.png b/Projectiles/Shrines/GladiatorSword.png new file mode 100644 index 0000000000..78d0d29fab Binary files /dev/null and b/Projectiles/Shrines/GladiatorSword.png differ diff --git a/Projectiles/Shrines/GladiatorSword2.cs b/Projectiles/Shrines/GladiatorSword2.cs new file mode 100644 index 0000000000..4d5a3c0d0f --- /dev/null +++ b/Projectiles/Shrines/GladiatorSword2.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Shrines +{ + public class GladiatorSword2 : ModProjectile + { + private double rotation = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gladiator Sword"); + ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 22; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.tileCollide = false; + projectile.friendly = true; + projectile.timeLeft *= 5; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("GladiatorSword2"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (!modPlayer.gladiatorSword) + { + projectile.active = false; + return; + } + if (flag64) + { + if (player.dead) + { + modPlayer.glSword = false; + } + if (modPlayer.glSword) + { + projectile.timeLeft = 2; + } + } + Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); + Vector2 vector = player.Center - projectile.Center; + projectile.rotation = vector.ToRotation() - 1.57f; + projectile.Center = player.Center + new Vector2(80, 0).RotatedBy(rotation); + rotation -= 0.03; + if (rotation <= 0) + { + rotation = 360; + } + projectile.velocity.X = ((vector.X > 0f) ? -0.000001f : 0f); + } + } +} \ No newline at end of file diff --git a/Projectiles/Shrines/GladiatorSword2.png b/Projectiles/Shrines/GladiatorSword2.png new file mode 100644 index 0000000000..78d0d29fab Binary files /dev/null and b/Projectiles/Shrines/GladiatorSword2.png differ diff --git a/Projectiles/Shrines/LuxorsGiftMagic.cs b/Projectiles/Shrines/LuxorsGiftMagic.cs new file mode 100644 index 0000000000..11c6902fb3 --- /dev/null +++ b/Projectiles/Shrines/LuxorsGiftMagic.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Shrines +{ + public class LuxorsGiftMagic : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gift"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.magic = true; + projectile.penetrate = 2; + projectile.alpha = 255; + projectile.timeLeft = 240; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 3f) + { + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default(Vector2)) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 244, 0f, 0f, 160, default(Color), 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + projectile.velocity *= 0.25f; + } + } +} \ No newline at end of file diff --git a/Projectiles/Shrines/LuxorsGiftMagic.png b/Projectiles/Shrines/LuxorsGiftMagic.png new file mode 100644 index 0000000000..490eb24528 Binary files /dev/null and b/Projectiles/Shrines/LuxorsGiftMagic.png differ diff --git a/Projectiles/Shrines/LuxorsGiftMelee.cs b/Projectiles/Shrines/LuxorsGiftMelee.cs new file mode 100644 index 0000000000..e72b66246a --- /dev/null +++ b/Projectiles/Shrines/LuxorsGiftMelee.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Shrines +{ + public class LuxorsGiftMelee : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gift"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.melee = true; + projectile.penetrate = 3; + projectile.alpha = 255; + projectile.timeLeft = 300; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 3f) + { + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default(Vector2)) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 235, 0f, 0f, 160, default(Color), 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Main.PlaySound(SoundID.Item10, projectile.position); + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default(Vector2)) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 235, 0f, 0f, 160, default(Color), 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Shrines/LuxorsGiftMelee.png b/Projectiles/Shrines/LuxorsGiftMelee.png new file mode 100644 index 0000000000..4f4e05f92d Binary files /dev/null and b/Projectiles/Shrines/LuxorsGiftMelee.png differ diff --git a/Projectiles/Shrines/LuxorsGiftRanged.cs b/Projectiles/Shrines/LuxorsGiftRanged.cs new file mode 100644 index 0000000000..62b764ce6f --- /dev/null +++ b/Projectiles/Shrines/LuxorsGiftRanged.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Shrines +{ + public class LuxorsGiftRanged : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gift"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.ranged = true; + projectile.penetrate = 1; + projectile.alpha = 255; + projectile.timeLeft = 180; + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 3f) + { + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default(Vector2)) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 135, 0f, 0f, 160, default(Color), 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 92); + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, mod.ProjectileType("BoltExplosion"), projectile.damage, 0f, projectile.owner, 0f, 0f); + } + int num212 = Main.rand.Next(10, 20); + for (int num213 = 0; num213 < num212; num213++) + { + int num214 = Dust.NewDust(projectile.Center - projectile.velocity / 2f, 0, 0, 135, 0f, 0f, 100, default(Color), 2f); + Main.dust[num214].velocity *= 2f; + Main.dust[num214].noGravity = true; + } + } + } +} \ No newline at end of file diff --git a/Projectiles/Shrines/LuxorsGiftRanged.png b/Projectiles/Shrines/LuxorsGiftRanged.png new file mode 100644 index 0000000000..86c8cace93 Binary files /dev/null and b/Projectiles/Shrines/LuxorsGiftRanged.png differ diff --git a/Projectiles/Shrines/LuxorsGiftRogue.cs b/Projectiles/Shrines/LuxorsGiftRogue.cs new file mode 100644 index 0000000000..793fef684b --- /dev/null +++ b/Projectiles/Shrines/LuxorsGiftRogue.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Shrines +{ + public class LuxorsGiftRogue : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gift"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 4; + projectile.aiStyle = 2; + projectile.alpha = 255; + projectile.timeLeft = 300; + aiType = 48; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.GetGlobalProjectile(mod).rogue = true; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] == 3f) + { + for (int l = 0; l < 12; l++) + { + Vector2 vector3 = Vector2.UnitX * (float)(-(float)projectile.width) / 2f; + vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default(Vector2)) * new Vector2(8f, 16f); + vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default(Vector2)); + int num9 = Dust.NewDust(projectile.Center, 0, 0, 173, 0f, 0f, 160, default(Color), 1f); + Main.dust[num9].scale = 1.1f; + Main.dust[num9].noGravity = true; + Main.dust[num9].position = projectile.Center + vector3; + Main.dust[num9].velocity = projectile.velocity * 0.1f; + Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + projectile.ai[0] += 0.1f; + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + } + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Shrines/LuxorsGiftRogue.png b/Projectiles/Shrines/LuxorsGiftRogue.png new file mode 100644 index 0000000000..4adb519052 Binary files /dev/null and b/Projectiles/Shrines/LuxorsGiftRogue.png differ diff --git a/Projectiles/Shrines/LuxorsGiftSummon.cs b/Projectiles/Shrines/LuxorsGiftSummon.cs new file mode 100644 index 0000000000..a9189142eb --- /dev/null +++ b/Projectiles/Shrines/LuxorsGiftSummon.cs @@ -0,0 +1,285 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Shrines +{ + public class LuxorsGiftSummon : ModProjectile + { + private int dust = 3; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Gift"); + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.netImportant = true; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.minionSlots = 0f; + projectile.timeLeft = 18000; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft *= 5; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + if (dust > 0) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X * 1.75f, vector7.Y * 1.75f, 100, default(Color), 1.1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].velocity = vector7; + } + dust--; + } + if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + if (projectile.localAI[0] == 0f) + { + projectile.scale -= 0.01f; + projectile.alpha += 15; + if (projectile.alpha >= 250) + { + projectile.alpha = 255; + projectile.localAI[0] = 1f; + } + } + else if (projectile.localAI[0] == 1f) + { + projectile.scale += 0.01f; + projectile.alpha -= 15; + if (projectile.alpha <= 0) + { + projectile.alpha = 0; + projectile.localAI[0] = 0f; + } + } + float num633 = 700f; + float num634 = 1000f; + float num635 = 2200f; + float num636 = 150f; + bool flag64 = projectile.type == mod.ProjectileType("LuxorsGiftSummon"); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.GetModPlayer(mod); + if (flag64) + { + if (!modPlayer.luxorsGift) + { + projectile.Kill(); + } + } + float num637 = 0.05f; + for (int num638 = 0; num638 < 1000; num638++) + { + bool flag23 = (Main.projectile[num638].type == mod.ProjectileType("LuxorsGiftSummon")); + if (num638 != projectile.whoAmI && Main.projectile[num638].active && Main.projectile[num638].owner == projectile.owner && + flag23 && Math.Abs(projectile.position.X - Main.projectile[num638].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num638].position.Y) < (float)projectile.width) + { + if (projectile.position.X < Main.projectile[num638].position.X) + { + projectile.velocity.X = projectile.velocity.X - num637; + } + else + { + projectile.velocity.X = projectile.velocity.X + num637; + } + if (projectile.position.Y < Main.projectile[num638].position.Y) + { + projectile.velocity.Y = projectile.velocity.Y - num637; + } + else + { + projectile.velocity.Y = projectile.velocity.Y + num637; + } + } + } + bool flag24 = false; + if (projectile.ai[0] == 2f) + { + projectile.ai[1] += 1f; + projectile.extraUpdates = 1; + projectile.rotation = projectile.velocity.ToRotation() + 1.57f; + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 1f; + projectile.ai[0] = 0f; + projectile.extraUpdates = 0; + projectile.numUpdates = 0; + projectile.netUpdate = true; + } + else + { + flag24 = true; + } + } + if (flag24) + { + return; + } + Vector2 vector46 = projectile.position; + bool flag25 = false; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } + float num647 = num634; + if (flag25) + { + num647 = num635; + } + if (Vector2.Distance(player.Center, projectile.Center) > num647) + { + projectile.ai[0] = 1f; + projectile.netUpdate = true; + } + if (flag25 && projectile.ai[0] == 0f) + { + Vector2 vector47 = vector46 - projectile.Center; + float num648 = vector47.Length(); + vector47.Normalize(); + if (num648 > 200f) + { + float scaleFactor2 = 9f; //8 + vector47 *= scaleFactor2; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + else + { + float num649 = 4f; + vector47 *= -num649; + projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; + } + } + else + { + bool flag26 = false; + if (!flag26) + { + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 6f; + if (flag26) + { + num650 = 15f; + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(0f, -60f); + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 8f) + { + num650 = 8f; + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.15f; + projectile.velocity.Y = -0.05f; + } + } + projectile.rotation = projectile.velocity.ToRotation() + 1.57f; + if (projectile.ai[1] > 0f) + { + projectile.ai[1] += (float)Main.rand.Next(1, 4); + } + if (projectile.ai[1] > 40f) + { + projectile.ai[1] = 0f; + projectile.netUpdate = true; + } + if (projectile.ai[0] == 0f) + { + if (projectile.ai[1] == 0f && flag25 && num633 < 500f) + { + projectile.ai[1] += 1f; + if (Main.myPlayer == projectile.owner) + { + projectile.ai[0] = 2f; + Vector2 value20 = vector46 - projectile.Center; + value20.Normalize(); + projectile.velocity = value20 * 9f; //8 + projectile.netUpdate = true; + } + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + if (projectile.timeLeft < 85) + { + byte b2 = (byte)(projectile.timeLeft * 3); + byte a2 = (byte)(100f * ((float)b2 / 255f)); + return new Color((int)b2, (int)b2, (int)b2, (int)a2); + } + return new Color(255, 255, 255, 100); + } + } +} \ No newline at end of file diff --git a/Projectiles/Shrines/LuxorsGiftSummon.png b/Projectiles/Shrines/LuxorsGiftSummon.png new file mode 100644 index 0000000000..bb9aa16eae Binary files /dev/null and b/Projectiles/Shrines/LuxorsGiftSummon.png differ diff --git a/Projectiles/Shrines/UnstableSpark.cs b/Projectiles/Shrines/UnstableSpark.cs new file mode 100644 index 0000000000..36f34cba5a --- /dev/null +++ b/Projectiles/Shrines/UnstableSpark.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Shrines +{ + public class UnstableSpark : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Unstable Spark"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 12; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.timeLeft = 120; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.1f; + } + if (projectile.velocity.X != projectile.velocity.X) + { + projectile.velocity.X = projectile.velocity.X * -0.5f; + } + if (projectile.velocity.Y != projectile.velocity.Y && projectile.velocity.Y > 1f) + { + projectile.velocity.Y = projectile.velocity.Y * -0.5f; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5f) + { + projectile.ai[0] = 5f; + if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) + { + projectile.velocity.X = projectile.velocity.X * 0.97f; + if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + { + projectile.velocity.X = 0f; + projectile.netUpdate = true; + } + } + projectile.velocity.Y = projectile.velocity.Y + 0.2f; + } + projectile.rotation += projectile.velocity.X * 0.1f; + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 0.5f); + Dust expr_8976_cp_0 = Main.dust[num199]; + expr_8976_cp_0.position.X = expr_8976_cp_0.position.X - 2f; + Dust expr_8994_cp_0 = Main.dust[num199]; + expr_8994_cp_0.position.Y = expr_8994_cp_0.position.Y + 2f; + Main.dust[num199].scale += (float)Main.rand.Next(50) * 0.01f; + Main.dust[num199].noGravity = true; + Dust expr_89E7_cp_0 = Main.dust[num199]; + expr_89E7_cp_0.velocity.Y = expr_89E7_cp_0.velocity.Y - 2f; + if (Main.rand.Next(2) == 0) + { + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 0.5f); + Dust expr_8A4E_cp_0 = Main.dust[num200]; + expr_8A4E_cp_0.position.X = expr_8A4E_cp_0.position.X - 2f; + Dust expr_8A6C_cp_0 = Main.dust[num200]; + expr_8A6C_cp_0.position.Y = expr_8A6C_cp_0.position.Y + 2f; + Main.dust[num200].scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; + Main.dust[num200].noGravity = true; + Main.dust[num200].velocity *= 0.1f; + } + if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + { + projectile.velocity.X = projectile.velocity.X * 0.8f; + } + projectile.rotation = -projectile.velocity.X * 0.05f; + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + } +} \ No newline at end of file diff --git a/Projectiles/Shrines/UnstableSpark.png b/Projectiles/Shrines/UnstableSpark.png new file mode 100644 index 0000000000..28f94674d6 Binary files /dev/null and b/Projectiles/Shrines/UnstableSpark.png differ diff --git a/Projectiles/Summon/AngryChicken.cs b/Projectiles/Summon/AngryChicken.cs index 811a55eb7c..e5e99d6e5a 100644 --- a/Projectiles/Summon/AngryChicken.cs +++ b/Projectiles/Summon/AngryChicken.cs @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] = 1f; projectile.ai[0] = 0f; projectile.extraUpdates = 1; - projectile.numUpdates = 0; //0 + projectile.numUpdates = 0; projectile.netUpdate = true; } else @@ -141,20 +141,37 @@ namespace CalamityMod.Projectiles.Summon } Vector2 vector46 = projectile.position; bool flag25 = false; - for (int num645 = 0; num645 < 200; num645++) + if (player.HasMinionAttackTargetNPC) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25)) + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { num633 = num646; - vector46 = nPC2.Center; + vector46 = npc.Center; flag25 = true; } } } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } float num647 = num634; if (flag25) { diff --git a/Projectiles/Summon/BigBustyRose.cs b/Projectiles/Summon/BigBustyRose.cs index fc991791ee..8c2a9557ea 100644 --- a/Projectiles/Summon/BigBustyRose.cs +++ b/Projectiles/Summon/BigBustyRose.cs @@ -135,20 +135,37 @@ namespace CalamityMod.Projectiles.Summon { projectile.tileCollide = false; } - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } if (Vector2.Distance(player.Center, projectile.Center) > 1200f) { projectile.ai[0] = 1f; diff --git a/Projectiles/Summon/BloodClotMinion.cs b/Projectiles/Summon/BloodClotMinion.cs index 31607e57af..c39c0606fa 100644 --- a/Projectiles/Summon/BloodClotMinion.cs +++ b/Projectiles/Summon/BloodClotMinion.cs @@ -129,21 +129,24 @@ namespace CalamityMod.Projectiles.Summon } if (projectile.ai[0] == 0f) { - NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) + if (player.HasMinionAttackTargetNPC) { - float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); - float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC2.position, ownerMinionAttackTargetNPC2.width, ownerMinionAttackTargetNPC2.height)) - { - num537 = num541; - num535 = num539; - num536 = num540; - flag19 = true; - } + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num537 = num541; + num535 = num539; + num536 = num540; + flag19 = true; + } + } } - if (!flag19) + else { for (int num542 = 0; num542 < 200; num542 = num3 + 1) { diff --git a/Projectiles/Summon/Calamari.cs b/Projectiles/Summon/Calamari.cs index 5c7dad9b74..279f5653ed 100644 --- a/Projectiles/Summon/Calamari.cs +++ b/Projectiles/Summon/Calamari.cs @@ -161,20 +161,23 @@ namespace CalamityMod.Projectiles.Summon Vector2 center = Main.player[projectile.owner].Center; Vector2 value = new Vector2(0.5f); value.Y = 0f; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + if (player.HasMinionAttackTargetNPC) { - Vector2 vector2 = ownerMinionAttackTargetNPC.position + ownerMinionAttackTargetNPC.Size * value; - float num12 = Vector2.Distance(vector2, center); - if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) - { - num10 = num12; - vector = vector2; - flag = true; - num11 = ownerMinionAttackTargetNPC.whoAmI; - } + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 vector2 = npc.position + npc.Size * value; + float num12 = Vector2.Distance(vector2, center); + if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num10 = num12; + vector = vector2; + flag = true; + num11 = npc.whoAmI; + } + } } - if (!flag) + else { for (int k = 0; k < 200; k++) { diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index 2a9da038cc..b739f40c7a 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Calamitamini"); Main.projFrames[projectile.type] = 3; - Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } @@ -116,20 +115,37 @@ namespace CalamityMod.Projectiles.Summon { projectile.tileCollide = false; } - for (int num645 = 0; num645 < 200; num645++) + if (player.HasMinionAttackTargetNPC) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { num633 = num646; - vector46 = nPC2.Center; + vector46 = npc.Center; flag25 = true; } } } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } float num647 = num634; if (flag25) { diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index 907990f50b..1bb1b33cce 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Cataclymini"); Main.projFrames[projectile.type] = 3; - Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } @@ -115,20 +114,37 @@ namespace CalamityMod.Projectiles.Summon { projectile.tileCollide = false; } - for (int num645 = 0; num645 < 200; num645++) + if (player.HasMinionAttackTargetNPC) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { num633 = num646; - vector46 = nPC2.Center; + vector46 = npc.Center; flag25 = true; } } } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } float num647 = num634; if (flag25) { diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index 39740a2788..38d1e44b8d 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -142,20 +142,37 @@ namespace CalamityMod.Projectiles.Summon { projectile.tileCollide = false; } - for (int num645 = 0; num645 < 200; num645++) + if (player.HasMinionAttackTargetNPC) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { num633 = num646; - vector46 = nPC2.Center; + vector46 = npc.Center; flag25 = true; } } } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } float num647 = num634; if (flag25) { diff --git a/Projectiles/Summon/ChaosSpirit.cs b/Projectiles/Summon/ChaosSpirit.cs index 927d5ce8f6..e808809569 100644 --- a/Projectiles/Summon/ChaosSpirit.cs +++ b/Projectiles/Summon/ChaosSpirit.cs @@ -15,8 +15,8 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Chaos Spirit"); Main.projFrames[projectile.type] = 9; - Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() @@ -110,21 +110,24 @@ namespace CalamityMod.Projectiles.Summon float num506 = projectile.Center.X; float num507 = projectile.Center.Y; float num508 = 1000f; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + if (player.HasMinionAttackTargetNPC) { - float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); - float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); - float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); - if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - num508 = num511; - num506 = num509; - num507 = num510; - flag18 = true; + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num508 = num541; + num506 = num539; + num507 = num540; + flag18 = true; + } } } - if (!flag18) + else { for (int num512 = 0; num512 < 200; num512++) { diff --git a/Projectiles/Summon/CloudyWaifu.cs b/Projectiles/Summon/CloudyWaifu.cs index fc279f3241..57a0bd31a9 100644 --- a/Projectiles/Summon/CloudyWaifu.cs +++ b/Projectiles/Summon/CloudyWaifu.cs @@ -151,20 +151,37 @@ namespace CalamityMod.Projectiles.Summon } Vector2 vector46 = projectile.position; bool flag25 = false; - for (int num645 = 0; num645 < 200; num645++) + if (player.HasMinionAttackTargetNPC) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { num633 = num646; - vector46 = nPC2.Center; + vector46 = npc.Center; flag25 = true; } } } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } float num647 = num634; if (flag25) { diff --git a/Projectiles/Summon/CosmicBlast.cs b/Projectiles/Summon/CosmicBlast.cs index a43e5b30d0..3977c2129e 100644 --- a/Projectiles/Summon/CosmicBlast.cs +++ b/Projectiles/Summon/CosmicBlast.cs @@ -54,22 +54,20 @@ namespace CalamityMod.Projectiles.Summon float num473 = projectile.Center.Y; float num474 = 1200f; bool flag17 = false; - for (int num475 = 0; num475 < 200; 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; - } - } - } + int target = (int)projectile.ai[0]; + if (Main.npc[target].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); + float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].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 = 40f; diff --git a/Projectiles/Summon/CosmicBlastBig.cs b/Projectiles/Summon/CosmicBlastBig.cs index 45bf67fd41..e65d15cae6 100644 --- a/Projectiles/Summon/CosmicBlastBig.cs +++ b/Projectiles/Summon/CosmicBlastBig.cs @@ -68,20 +68,18 @@ namespace CalamityMod.Projectiles.Summon float num473 = projectile.Center.Y; float num474 = 600f; bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) + int target = (int)projectile.ai[0]; + if (Main.npc[target].CanBeChasedBy(projectile, false)) { - if (Main.npc[num475].CanBeChasedBy(projectile, false)) + float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); + float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].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) { - 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; - } + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; } } if (flag17) @@ -96,7 +94,6 @@ namespace CalamityMod.Projectiles.Summon num485 *= num486; projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f; projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f; - return; } } diff --git a/Projectiles/Summon/CosmicEnergy.cs b/Projectiles/Summon/CosmicEnergy.cs index 3df25b9b02..a7d6c3a440 100644 --- a/Projectiles/Summon/CosmicEnergy.cs +++ b/Projectiles/Summon/CosmicEnergy.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Summon DisplayName.SetDefault("Cosmic Energy"); Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() @@ -96,20 +97,40 @@ namespace CalamityMod.Projectiles.Summon projectile.rotation += projectile.velocity.X * 0.1f; Vector2 vector46 = projectile.position; bool flag25 = false; - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - } + int target = 0; + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = npc.Center; + flag25 = true; + target = npc.whoAmI; + } + } + } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + target = num645; + } + } + } + } float num647 = num634; if (flag25) { @@ -228,7 +249,7 @@ namespace CalamityMod.Projectiles.Summon } value15.Normalize(); value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("CosmicBlast"), (int)((double)projectile.damage * 0.5), 2f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, mod.ProjectileType("CosmicBlast"), (int)((double)projectile.damage * 0.5), 2f, projectile.owner, (float)target, 0f); } float num403 = 15f; Vector2 vector29 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); @@ -238,7 +259,7 @@ namespace CalamityMod.Projectiles.Summon num406 = num403 / num406; num404 *= num406; num405 *= num406; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, mod.ProjectileType("CosmicBlastBig"), projectile.damage, 3f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, mod.ProjectileType("CosmicBlastBig"), projectile.damage, 3f, projectile.owner, (float)target, 0f); projectile.ai[0] = 100f; } } diff --git a/Projectiles/Summon/Cosmilamp.cs b/Projectiles/Summon/Cosmilamp.cs index 9a081e10e1..40804bb64c 100644 --- a/Projectiles/Summon/Cosmilamp.cs +++ b/Projectiles/Summon/Cosmilamp.cs @@ -123,23 +123,26 @@ namespace CalamityMod.Projectiles.Summon } if (projectile.ai[0] == 0f) { - NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) - { - float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); - float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num537) - { - num537 = num541; - num535 = num539; - num536 = num540; - flag19 = true; - } - } - if (!flag19) - { - for (int num542 = 0; num542 < 200; num542 = num3 + 1) + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num537 = num541; + num535 = num539; + num536 = num540; + flag19 = true; + } + } + } + else + { + for (int num542 = 0; num542 < 200; num542 = num3 + 1) { if (Main.npc[num542].CanBeChasedBy(projectile, false)) { diff --git a/Projectiles/Summon/DaedalusCrystal.cs b/Projectiles/Summon/DaedalusCrystal.cs index 72f4206965..14923a361e 100644 --- a/Projectiles/Summon/DaedalusCrystal.cs +++ b/Projectiles/Summon/DaedalusCrystal.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Daedalus Crystal"); - Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() @@ -102,21 +102,24 @@ namespace CalamityMod.Projectiles.Summon float num506 = projectile.Center.X; float num507 = projectile.Center.Y; float num508 = 1000f; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + if (player.HasMinionAttackTargetNPC) { - float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); - float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); - float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); - if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - num508 = num511; - num506 = num509; - num507 = num510; - flag18 = true; + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num508 = num541; + num506 = num539; + num507 = num540; + flag18 = true; + } } } - if (!flag18) + else { for (int num512 = 0; num512 < 200; num512++) { diff --git a/Projectiles/Summon/DaedalusCrystalShot.cs b/Projectiles/Summon/DaedalusCrystalShot.cs index 31efdbce27..f004bd9d3b 100644 --- a/Projectiles/Summon/DaedalusCrystalShot.cs +++ b/Projectiles/Summon/DaedalusCrystalShot.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num458].velocity *= 0.5f; Main.dust[num458].velocity += projectile.velocity * 0.1f; } - return; } public override void Kill(int timeLeft) diff --git a/Projectiles/Summon/DankCreeper.cs b/Projectiles/Summon/DankCreeper.cs index 327405ac6f..38f07e5f94 100644 --- a/Projectiles/Summon/DankCreeper.cs +++ b/Projectiles/Summon/DankCreeper.cs @@ -118,23 +118,26 @@ namespace CalamityMod.Projectiles.Summon } if (projectile.ai[0] == 0f) { - NPC ownerMinionAttackTargetNPC2 = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(projectile, false)) - { - float num539 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2); - float num540 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2); - float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); - if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC2.position, ownerMinionAttackTargetNPC2.width, ownerMinionAttackTargetNPC2.height)) - { - num537 = num541; - num535 = num539; - num536 = num540; - flag19 = true; - } - } - if (!flag19) - { - for (int num542 = 0; num542 < 200; num542 = num3 + 1) + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num537 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num537 = num541; + num535 = num539; + num536 = num540; + flag19 = true; + } + } + } + else + { + for (int num542 = 0; num542 < 200; num542 = num3 + 1) { if (Main.npc[num542].CanBeChasedBy(projectile, false)) { diff --git a/Projectiles/Summon/DrewsSandyWaifu.cs b/Projectiles/Summon/DrewsSandyWaifu.cs index b4840b7932..a6cb1f707a 100644 --- a/Projectiles/Summon/DrewsSandyWaifu.cs +++ b/Projectiles/Summon/DrewsSandyWaifu.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Projectiles.Summon Main.projFrames[projectile.type] = 5; Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() @@ -42,16 +41,16 @@ namespace CalamityMod.Projectiles.Summon (CalamityWorld.downedYharon ? 3 : 0); } - public override void AI() - { - bool flag64 = projectile.type == mod.ProjectileType("DrewsSandyWaifu"); + public override void AI() + { + bool flag64 = projectile.type == mod.ProjectileType("DrewsSandyWaifu"); Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.GetModPlayer(mod); if (!modPlayer.sandBoobWaifu && !modPlayer.allWaifus) - { - projectile.active = false; - return; - } + { + projectile.active = false; + return; + } if (flag64) { if (player.dead) @@ -63,19 +62,19 @@ namespace CalamityMod.Projectiles.Summon projectile.timeLeft = 2; } } - dust--; - if (dust >= 0) - { + dust--; + if (dust >= 0) + { projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) + for (int num502 = 0; num502 < num501; num502++) { int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 32, 0f, 0f, 0, default(Color), 1f); Main.dust[num503].velocity *= 2f; Main.dust[num503].scale *= 1.15f; } - } + } if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) { int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / @@ -86,20 +85,20 @@ namespace CalamityMod.Projectiles.Summon projectile.frameCounter++; if (projectile.frameCounter > 16) { - projectile.frame++; - projectile.frameCounter = 0; + projectile.frame++; + projectile.frameCounter = 0; } if (projectile.frame > 3) { - projectile.frame = 0; + projectile.frame = 0; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if ((double)Math.Abs(projectile.velocity.X) > 0.2) { projectile.spriteDirection = -projectile.direction; - } + } float num636 = 100f; //150 float num = (float)Main.rand.Next(90, 111) * 0.01f; - num *= Main.essScale; + num *= Main.essScale; Lighting.AddLight(projectile.Center, 0.7f * num, 0.6f * num, 0f * num); float num637 = 0.05f; for (int num638 = 0; num638 < 1000; num638++) @@ -125,132 +124,51 @@ namespace CalamityMod.Projectiles.Summon } } } - /*bool flag24 = false; - if (projectile.ai[0] == 2f) - { - projectile.ai[1] += 1f; - projectile.extraUpdates = 1; - projectile.frameCounter++; - if (projectile.frameCounter > 16) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - if (projectile.ai[1] > 40f) - { - projectile.ai[1] = 1f; - projectile.ai[0] = 0f; - projectile.extraUpdates = 0; - projectile.numUpdates = 0; - projectile.netUpdate = true; - } - else - { - flag24 = true; - } - } - if (flag24) - { - return; - }*/ - /*Vector2 vector46 = projectile.position; - bool flag25 = false; - if (projectile.ai[0] != 1f) - { - projectile.tileCollide = false; - } - if (projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16))) - { - projectile.tileCollide = false; - } - for (int num645 = 0; num645 < 200; num645++) - { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) - { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) - { - num633 = num646; - vector46 = nPC2.Center; - flag25 = true; - } - } - }*/ - /*if (flag25) - { - num647 = num635; - }*/ if (Vector2.Distance(player.Center, projectile.Center) > 400f) { projectile.ai[0] = 1f; projectile.tileCollide = false; projectile.netUpdate = true; } - /*if (flag25 && projectile.ai[0] == 0f) + bool flag26 = false; + if (!flag26) { - Vector2 vector47 = vector46 - projectile.Center; - float num648 = vector47.Length(); - vector47.Normalize(); - if (num648 > 200f) - { - float scaleFactor2 = 6f; //8 - vector47 *= scaleFactor2; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } - else - { - float num649 = 4f; - vector47 *= -num649; - projectile.velocity = (projectile.velocity * 40f + vector47) / 41f; - } + flag26 = (projectile.ai[0] == 1f); + } + float num650 = 7f; //6 + if (flag26) + { + num650 = 18f; //15 + } + Vector2 center2 = projectile.Center; + Vector2 vector48 = player.Center - center2 + new Vector2(-250f, -60f); //-60 + float num651 = vector48.Length(); + if (num651 > 200f && num650 < 10f) //200 and 8 + { + num650 = 10f; //8 + } + if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + { + projectile.ai[0] = 0f; + projectile.netUpdate = true; + } + if (num651 > 2000f) + { + projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); + projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); + projectile.netUpdate = true; + } + if (num651 > 70f) + { + vector48.Normalize(); + vector48 *= num650; + projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; + } + else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) + { + projectile.velocity.X = -0.22f; + projectile.velocity.Y = -0.12f; } - else - {*/ - bool flag26 = false; - if (!flag26) - { - flag26 = (projectile.ai[0] == 1f); - } - float num650 = 7f; //6 - if (flag26) - { - num650 = 18f; //15 - } - Vector2 center2 = projectile.Center; - Vector2 vector48 = player.Center - center2 + new Vector2(-250f, -60f); //-60 - float num651 = vector48.Length(); - if (num651 > 200f && num650 < 10f) //200 and 8 - { - num650 = 10f; //8 - } - if (num651 < num636 && flag26 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - } - if (num651 > 2000f) - { - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2); - projectile.netUpdate = true; - } - if (num651 > 70f) - { - vector48.Normalize(); - vector48 *= num650; - projectile.velocity = (projectile.velocity * 40f + vector48) / 41f; - } - else if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) - { - projectile.velocity.X = -0.22f; - projectile.velocity.Y = -0.12f; - } - //} projectile.frameCounter++; if (projectile.frameCounter > 16) { @@ -270,10 +188,10 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] = 0f; projectile.netUpdate = true; } - if (projectile.localAI[0] < 120f) - { - projectile.localAI[0] += 1f; - } + if (projectile.localAI[0] < 120f) + { + projectile.localAI[0] += 1f; + } if (projectile.ai[0] == 0f) { int num658 = mod.ProjectileType("CactusHealOrb"); @@ -282,22 +200,22 @@ namespace CalamityMod.Projectiles.Summon projectile.ai[1] += 1f; if (Main.myPlayer == projectile.owner && Main.player[projectile.owner].statLife < Main.player[projectile.owner].statLifeMax2) { - Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 6); - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) - { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X * 1.5f, vector7.Y * 1.5f, 100, new Color(0, 200, 0), 1f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; - } - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -6f, num658, 0, 0f, Main.myPlayer, 0f, 0f); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 6); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 107, vector7.X * 1.5f, vector7.Y * 1.5f, 100, new Color(0, 200, 0), 1f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, -6f, num658, 0, 0f, Main.myPlayer, 0f, 0f); } } } - } + } } } \ No newline at end of file diff --git a/Projectiles/Summon/ElementalAxe.cs b/Projectiles/Summon/ElementalAxe.cs index e6b366074f..98b0d53ead 100644 --- a/Projectiles/Summon/ElementalAxe.cs +++ b/Projectiles/Summon/ElementalAxe.cs @@ -115,20 +115,37 @@ namespace CalamityMod.Projectiles.Summon } Vector2 vector46 = projectile.position; bool flag25 = false; - for (int num645 = 0; num645 < 200; num645++) + if (player.HasMinionAttackTargetNPC) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25)) + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { num633 = num646; - vector46 = nPC2.Center; + vector46 = npc.Center; flag25 = true; } } } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } float num647 = num634; if (flag25) { diff --git a/Projectiles/Summon/FlameBlast.cs b/Projectiles/Summon/FlameBlast.cs index 524d668599..79d3b27c08 100644 --- a/Projectiles/Summon/FlameBlast.cs +++ b/Projectiles/Summon/FlameBlast.cs @@ -72,20 +72,18 @@ namespace CalamityMod.Projectiles.Summon float num473 = projectile.Center.Y; float num474 = 300f; bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) + int target = (int)projectile.ai[0]; + if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); + float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].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) { - 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; - } + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; } } if (flag17) diff --git a/Projectiles/Summon/FlameBurst.cs b/Projectiles/Summon/FlameBurst.cs index 7e1414bc68..5f428c8c0f 100644 --- a/Projectiles/Summon/FlameBurst.cs +++ b/Projectiles/Summon/FlameBurst.cs @@ -72,20 +72,18 @@ namespace CalamityMod.Projectiles.Summon float num473 = projectile.Center.Y; float num474 = 1200f; bool flag17 = false; - for (int num475 = 0; num475 < 200; num475++) + int target = (int)projectile.ai[0]; + if (Main.npc[target].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[target].Center, 1, 1)) { - if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1)) + float num476 = Main.npc[target].position.X + (float)(Main.npc[target].width / 2); + float num477 = Main.npc[target].position.Y + (float)(Main.npc[target].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) { - 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; - } + num474 = num478; + num472 = num476; + num473 = num477; + flag17 = true; } } if (flag17) diff --git a/Projectiles/Summon/FungalClump.cs b/Projectiles/Summon/FungalClump.cs index 3e01f517b0..10539a687d 100644 --- a/Projectiles/Summon/FungalClump.cs +++ b/Projectiles/Summon/FungalClump.cs @@ -87,7 +87,11 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - float num = (float)damage * 0.25f; + if (target.type == NPCID.TargetDummy || !target.canGhostHeal) + { + return; + } + float num = (float)damage * 0.25f; if ((int)num == 0) { return; diff --git a/Projectiles/Summon/Herring.cs b/Projectiles/Summon/Herring.cs index b2df7584bb..1657810670 100644 --- a/Projectiles/Summon/Herring.cs +++ b/Projectiles/Summon/Herring.cs @@ -142,20 +142,37 @@ namespace CalamityMod.Projectiles.Summon } Vector2 vector46 = projectile.position; bool flag25 = false; - for (int num645 = 0; num645 < 200; num645++) + if (player.HasMinionAttackTargetNPC) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { num633 = num646; - vector46 = nPC2.Center; + vector46 = npc.Center; flag25 = true; } } } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } float num647 = num634; if (flag25) { diff --git a/Projectiles/Summon/IceClasper.cs b/Projectiles/Summon/IceClasper.cs index 192a409419..88e45a5881 100644 --- a/Projectiles/Summon/IceClasper.cs +++ b/Projectiles/Summon/IceClasper.cs @@ -139,20 +139,37 @@ namespace CalamityMod.Projectiles.Summon } Vector2 vector46 = projectile.position; bool flag25 = false; - for (int num645 = 0; num645 < 200; num645++) + if (player.HasMinionAttackTargetNPC) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25)) + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { num633 = num646; - vector46 = nPC2.Center; + vector46 = npc.Center; flag25 = true; } } } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } float num647 = num634; if (flag25) { diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index 5c14584903..527eaa9f7b 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -10,7 +10,10 @@ namespace CalamityMod.Projectiles.Summon { public class MechwormBody : ModProjectile { - public override void SetStaticDefaults() + private int playerMinionSlots = 0; + private bool runCheck = true; + + public override void SetStaticDefaults() { DisplayName.SetDefault("Mechworm"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; @@ -37,12 +40,21 @@ namespace CalamityMod.Projectiles.Summon { Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); Player player9 = Main.player[projectile.owner]; + if (player9.maxMinions > playerMinionSlots) + { + playerMinionSlots = player9.maxMinions; + } + if (runCheck) + { + runCheck = false; + playerMinionSlots = player9.maxMinions; + } CalamityPlayer modPlayer = player9.GetModPlayer(mod); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } - if (!player9.active) + if (!player9.active || player9.maxMinions < playerMinionSlots) { projectile.active = false; return; diff --git a/Projectiles/Summon/MechwormBody2.cs b/Projectiles/Summon/MechwormBody2.cs index 29a700aa4b..b05a099dfa 100644 --- a/Projectiles/Summon/MechwormBody2.cs +++ b/Projectiles/Summon/MechwormBody2.cs @@ -14,7 +14,10 @@ namespace CalamityMod.Projectiles.Summon { public class MechwormBody2 : ModProjectile { - public override void SetStaticDefaults() + private int playerMinionSlots = 0; + private bool runCheck = true; + + public override void SetStaticDefaults() { DisplayName.SetDefault("Mechworm"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; @@ -41,12 +44,21 @@ namespace CalamityMod.Projectiles.Summon { Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); Player player9 = Main.player[projectile.owner]; + if (player9.maxMinions > playerMinionSlots) + { + playerMinionSlots = player9.maxMinions; + } + if (runCheck) + { + runCheck = false; + playerMinionSlots = player9.maxMinions; + } CalamityPlayer modPlayer = player9.GetModPlayer(mod); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } - if (!player9.active) + if (!player9.active || player9.maxMinions < playerMinionSlots) { projectile.active = false; return; diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index 6749760d1b..0ede2f387f 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -10,8 +10,10 @@ namespace CalamityMod.Projectiles.Summon { public class MechwormHead : ModProjectile { - public int dust = 3; - + private int dust = 3; + private int playerMinionSlots = 0; + private bool runCheck = true; + public override void SetStaticDefaults() { DisplayName.SetDefault("Mechworm"); @@ -38,26 +40,35 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { + Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); + Player player9 = Main.player[projectile.owner]; if (dust > 0) - { + { int num501 = 50; - for (int num502 = 0; num502 < num501; num502++) + for (int num502 = 0; num502 < num501; num502++) { int num503 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y + 16f), projectile.width, projectile.height - 16, 234, 0f, 0f, 0, default(Color), 1f); Main.dust[num503].velocity *= 2f; Main.dust[num503].scale *= 1.15f; } - dust--; - } - Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); - Player player9 = Main.player[projectile.owner]; + dust--; + } + if (player9.maxMinions > playerMinionSlots) + { + playerMinionSlots = player9.maxMinions; + } + if (runCheck) + { + runCheck = false; + playerMinionSlots = player9.maxMinions; + } CalamityPlayer modPlayer = player9.GetModPlayer(mod); player9.AddBuff(mod.BuffType("Mechworm"), 3600); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } - if (!player9.active) + if (!player9.active || player9.maxMinions < playerMinionSlots) { projectile.active = false; return; @@ -80,18 +91,33 @@ namespace CalamityMod.Projectiles.Summon projectile.Center = center14; projectile.netUpdate = true; } - for (int num1056 = 0; num1056 < 200; num1056++) - { - NPC nPC13 = Main.npc[num1056]; - if (nPC13.CanBeChasedBy(projectile, false) && player9.Distance(nPC13.Center) < num1054) - { - float num1057 = projectile.Distance(nPC13.Center); - if (num1057 < num1053) - { - num1055 = num1056; - } - } - } + if (player9.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player9.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false) && player9.Distance(npc.Center) < num1054) + { + float num1057 = projectile.Distance(npc.Center); + if (num1057 < num1053) + { + num1055 = npc.whoAmI; + } + } + } + else + { + for (int num1056 = 0; num1056 < 200; num1056++) + { + NPC nPC13 = Main.npc[num1056]; + if (nPC13.CanBeChasedBy(projectile, false) && player9.Distance(nPC13.Center) < num1054) + { + float num1057 = projectile.Distance(nPC13.Center); + if (num1057 < num1053) + { + num1055 = num1056; + } + } + } + } if (num1055 != -1) { NPC nPC14 = Main.npc[num1055]; diff --git a/Projectiles/Summon/MechwormTail.cs b/Projectiles/Summon/MechwormTail.cs index d4b8a36343..8a1bc61c34 100644 --- a/Projectiles/Summon/MechwormTail.cs +++ b/Projectiles/Summon/MechwormTail.cs @@ -10,7 +10,10 @@ namespace CalamityMod.Projectiles.Summon { public class MechwormTail : ModProjectile { - public override void SetStaticDefaults() + private int playerMinionSlots = 0; + private bool runCheck = true; + + public override void SetStaticDefaults() { DisplayName.SetDefault("Mechworm"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; @@ -37,12 +40,21 @@ namespace CalamityMod.Projectiles.Summon { Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 0.15f, 0.01f, 0.15f); Player player9 = Main.player[projectile.owner]; + if (player9.maxMinions > playerMinionSlots) + { + playerMinionSlots = player9.maxMinions; + } + if (runCheck) + { + runCheck = false; + playerMinionSlots = player9.maxMinions; + } CalamityPlayer modPlayer = player9.GetModPlayer(mod); if ((int)Main.time % 120 == 0) { projectile.netUpdate = true; } - if (!player9.active) + if (!player9.active || player9.maxMinions < playerMinionSlots) { projectile.active = false; return; diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index 2dddf7510c..418d803bc4 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Phantom"); - Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } @@ -102,20 +101,37 @@ namespace CalamityMod.Projectiles.Summon } Vector2 vector46 = projectile.position; bool flag25 = false; - for (int num645 = 0; num645 < 200; num645++) + if (player.HasMinionAttackTargetNPC) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25)) + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { num633 = num646; - vector46 = nPC2.Center; + vector46 = npc.Center; flag25 = true; } } } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } float num647 = num634; if (flag25) { diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index facede2fc8..7d127684cd 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Profaned Energy"); Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() @@ -83,21 +84,26 @@ namespace CalamityMod.Projectiles.Summon float num506 = projectile.Center.X; float num507 = projectile.Center.Y; float num508 = 1000f; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + int target = 0; + if (Main.player[projectile.owner].HasMinionAttackTargetNPC) { - float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); - float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); - float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); - if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + NPC npc = Main.npc[Main.player[projectile.owner].MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - num508 = num511; - num506 = num509; - num507 = num510; - flag18 = true; + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num508 = num541; + num506 = num539; + num507 = num540; + flag18 = true; + target = npc.whoAmI; + } } } - if (!flag18) + else { for (int num512 = 0; num512 < 200; num512++) { @@ -112,6 +118,7 @@ namespace CalamityMod.Projectiles.Summon num506 = num513; num507 = num514; flag18 = true; + target = num512; } } } @@ -147,7 +154,7 @@ namespace CalamityMod.Projectiles.Summon num406 = num403 / num406; num404 *= num406; num405 *= num406; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num404, num405, projectileType, projectile.damage, projectile.knockBack, projectile.owner, (float)target, 0f); projectile.ai[0] = 8f; } } diff --git a/Projectiles/Summon/ReaverOrb.cs b/Projectiles/Summon/ReaverOrb.cs index 584c65d89d..e9f7856d71 100644 --- a/Projectiles/Summon/ReaverOrb.cs +++ b/Projectiles/Summon/ReaverOrb.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Reaver Orb"); - Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; } @@ -97,39 +96,18 @@ namespace CalamityMod.Projectiles.Summon return; } bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; float num508 = 600f; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + for (int num512 = 0; num512 < 200; num512++) { - float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); - float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); - float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); - if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + if (Main.npc[num512].CanBeChasedBy(projectile, false)) { - num508 = num511; - num506 = num509; - num507 = num510; - flag18 = true; - } - } - if (!flag18) - { - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; - } + num508 = num515; + flag18 = true; } } } diff --git a/Projectiles/Summon/RedDevil.cs b/Projectiles/Summon/RedDevil.cs index db6609bf3a..e818edbdb0 100644 --- a/Projectiles/Summon/RedDevil.cs +++ b/Projectiles/Summon/RedDevil.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Red Devil"); Main.projFrames[projectile.type] = 5; - Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() @@ -143,20 +143,37 @@ namespace CalamityMod.Projectiles.Summon { projectile.tileCollide = false; } - for (int num645 = 0; num645 < 200; num645++) + if (player.HasMinionAttackTargetNPC) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { num633 = num646; - vector46 = nPC2.Center; + vector46 = npc.Center; flag25 = true; } } } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } float num647 = num634; if (flag25) { diff --git a/Projectiles/Summon/Sandnado.cs b/Projectiles/Summon/Sandnado.cs index a824b030dc..4c6eb54f1f 100644 --- a/Projectiles/Summon/Sandnado.cs +++ b/Projectiles/Summon/Sandnado.cs @@ -123,22 +123,25 @@ namespace CalamityMod.Projectiles.Summon } Vector2 center = Main.player[projectile.owner].Center; Vector2 value = new Vector2(0.5f); - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) - { - Vector2 vector2 = ownerMinionAttackTargetNPC.position + ownerMinionAttackTargetNPC.Size * value; - float num12 = Vector2.Distance(vector2, center); - if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) - { - num10 = num12; - vector = vector2; - flag = true; - num11 = ownerMinionAttackTargetNPC.whoAmI; - } - } - if (!flag) - { - for (int k = 0; k < 200; k++) + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + Vector2 vector2 = npc.position + npc.Size * value; + float num12 = Vector2.Distance(vector2, center); + if (((Vector2.Distance(center, vector) > num12 && num12 < num10) || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num10 = num12; + vector = vector2; + flag = true; + num11 = npc.whoAmI; + } + } + } + else + { + for (int k = 0; k < 200; k++) { NPC nPC = Main.npc[k]; if (nPC.CanBeChasedBy(projectile, false)) diff --git a/Projectiles/Summon/SandyWaifu.cs b/Projectiles/Summon/SandyWaifu.cs index 2f5bc00bcb..f989346921 100644 --- a/Projectiles/Summon/SandyWaifu.cs +++ b/Projectiles/Summon/SandyWaifu.cs @@ -127,20 +127,37 @@ namespace CalamityMod.Projectiles.Summon { projectile.tileCollide = false; } - for (int num645 = 0; num645 < 200; num645++) + if (player.HasMinionAttackTargetNPC) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if ((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) { num633 = num646; - vector46 = nPC2.Center; + vector46 = npc.Center; flag25 = true; } } } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } float num647 = num634; if (flag25) { diff --git a/Projectiles/Summon/SilvaCrystal.cs b/Projectiles/Summon/SilvaCrystal.cs index 554f988728..ae4d6f0405 100644 --- a/Projectiles/Summon/SilvaCrystal.cs +++ b/Projectiles/Summon/SilvaCrystal.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Silva Crystal"); ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() @@ -118,16 +119,19 @@ namespace CalamityMod.Projectiles.Summon { int num1074 = -1; float num1075 = num1072; - NPC ownerMinionAttackTargetNPC6 = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC6 != null && ownerMinionAttackTargetNPC6.CanBeChasedBy(projectile, false)) - { - float num1076 = projectile.Distance(ownerMinionAttackTargetNPC6.Center); - if (num1076 < num1075 && Collision.CanHitLine(projectile.Center, 0, 0, ownerMinionAttackTargetNPC6.Center, 0, 0)) - { - num1075 = num1076; - num1074 = ownerMinionAttackTargetNPC6.whoAmI; - } - } + if (player.HasMinionAttackTargetNPC) + { + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) + { + float num1076 = projectile.Distance(npc.Center); + if (num1076 < num1075 && Collision.CanHitLine(projectile.Center, 0, 0, npc.Center, 0, 0)) + { + num1075 = num1076; + num1074 = npc.whoAmI; + } + } + } if (num1074 < 0) { int num30; diff --git a/Projectiles/Summon/SilvaCrystalExplosion.cs b/Projectiles/Summon/SilvaCrystalExplosion.cs index bfc4465edf..0efed1dee8 100644 --- a/Projectiles/Summon/SilvaCrystalExplosion.cs +++ b/Projectiles/Summon/SilvaCrystalExplosion.cs @@ -218,7 +218,9 @@ namespace CalamityMod.Projectiles.Summon projectile.Center = projectile.position; projectile.penetrate = -1; projectile.maxPenetrate = -1; - projectile.Damage(); + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.Damage(); projectile.penetrate = num75; projectile.position = projectile.Center; projectile.width = width; diff --git a/Projectiles/Summon/SirenLure.cs b/Projectiles/Summon/SirenLure.cs index d6f935e5fa..f76bcb7f7a 100644 --- a/Projectiles/Summon/SirenLure.cs +++ b/Projectiles/Summon/SirenLure.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Projectiles.Summon { DisplayName.SetDefault("Siren Lure"); Main.projFrames[projectile.type] = 6; - Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() @@ -111,21 +111,24 @@ namespace CalamityMod.Projectiles.Summon float num506 = projectile.Center.X; float num507 = projectile.Center.Y; float num508 = 1000f; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + if (player.HasMinionAttackTargetNPC) { - float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); - float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); - float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); - if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - num508 = num511; - num506 = num509; - num507 = num510; - flag18 = true; + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + { + num508 = num541; + num506 = num539; + num507 = num540; + flag18 = true; + } } } - if (!flag18) + else { for (int num512 = 0; num512 < 200; num512++) { diff --git a/Projectiles/Summon/SolarGod.cs b/Projectiles/Summon/SolarGod.cs index c679c4b040..a0f5334532 100644 --- a/Projectiles/Summon/SolarGod.cs +++ b/Projectiles/Summon/SolarGod.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Solar God"); - Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() @@ -96,22 +96,42 @@ namespace CalamityMod.Projectiles.Summon float num397 = projectile.position.Y; float num398 = 700f; bool flag11 = false; - for (int num399 = 0; num399 < 200; num399++) + if (player.HasMinionAttackTargetNPC) { - if (Main.npc[num399].CanBeChasedBy(projectile, true)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); - float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); - float num402 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num400) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num401); - if (num402 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].height)) + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num398 = num402; - num396 = num400; - num397 = num401; + num398 = num541; + num396 = num539; + num397 = num540; flag11 = true; } } } + else + { + for (int num399 = 0; num399 < 200; num399++) + { + if (Main.npc[num399].CanBeChasedBy(projectile, true)) + { + float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); + float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); + float num402 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num400) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num401); + if (num402 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].height)) + { + num398 = num402; + num396 = num400; + num397 = num401; + flag11 = true; + } + } + } + } if (flag11) { float num403 = 35f; diff --git a/Projectiles/Summon/SolarPixie.cs b/Projectiles/Summon/SolarPixie.cs index dfc9b8295b..b15bb0c19d 100644 --- a/Projectiles/Summon/SolarPixie.cs +++ b/Projectiles/Summon/SolarPixie.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Solar Pixie"); - Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; + ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() @@ -96,22 +96,42 @@ namespace CalamityMod.Projectiles.Summon float num397 = projectile.position.Y; float num398 = 700f; bool flag11 = false; - for (int num399 = 0; num399 < 200; num399++) + if (player.HasMinionAttackTargetNPC) { - if (Main.npc[num399].CanBeChasedBy(projectile, true)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); - float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); - float num402 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num400) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num401); - if (num402 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].height)) + float num539 = npc.position.X + (float)(npc.width / 2); + float num540 = npc.position.Y + (float)(npc.height / 2); + float num541 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num539) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num540); + if (num541 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num398 = num402; - num396 = num400; - num397 = num401; + num398 = num541; + num396 = num539; + num397 = num540; flag11 = true; } } } + else + { + for (int num399 = 0; num399 < 200; num399++) + { + if (Main.npc[num399].CanBeChasedBy(projectile, true)) + { + float num400 = Main.npc[num399].position.X + (float)(Main.npc[num399].width / 2); + float num401 = Main.npc[num399].position.Y + (float)(Main.npc[num399].height / 2); + float num402 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num400) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num401); + if (num402 < num398 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num399].position, Main.npc[num399].width, Main.npc[num399].height)) + { + num398 = num402; + num396 = num400; + num397 = num401; + flag11 = true; + } + } + } + } if (flag11) { float num403 = 30f; diff --git a/Projectiles/Summon/Spikecrag.cs b/Projectiles/Summon/Spikecrag.cs new file mode 100644 index 0000000000..c1467dd58e --- /dev/null +++ b/Projectiles/Summon/Spikecrag.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class Spikecrag : ModProjectile + { + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Spikecrag"); + Main.projFrames[projectile.type] = 4; + } + + public override void SetDefaults() + { + projectile.width = 70; + projectile.height = 42; + projectile.ignoreWater = true; + projectile.tileCollide = true; + projectile.sentry = true; + projectile.timeLeft = Projectile.SentryLifeTime; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 15; + } + + public override void AI() + { + if (projectile.localAI[0] == 0f) + { + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue = Main.player[projectile.owner].minionDamage; + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue = projectile.damage; + projectile.localAI[0] += 1f; + } + if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) + { + int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / + projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) * + Main.player[projectile.owner].minionDamage); + projectile.damage = damage2; + } + + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + { + projectile.frame = 0; + } + projectile.velocity.Y += 0.5f; + + if (projectile.velocity.Y > 10f) + { + projectile.velocity.Y = 10f; + } + + float centerX = projectile.Center.X; + float centerY = projectile.Center.Y; + float num474 = 1000f; + bool homeIn = false; + for (int i = 0; i < 200; i++) + { + if (Main.npc[i].CanBeChasedBy(projectile, false)) + { + float num476 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2); + float num477 = Main.npc[i].position.Y + (float)(Main.npc[i].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; + homeIn = true; + } + } + } + if (projectile.owner == Main.myPlayer && homeIn) + { + if (projectile.ai[0] != 0f) + { + projectile.ai[0] -= 1f; + return; + } + projectile.ai[1] += 1f; + if ((projectile.ai[1] % 10f) == 0f) + { + int amount = Main.rand.Next(6, 10); + for (int i = 0; i < amount; i++) + { + float velocityX = Main.rand.NextFloat(-10f, 10f); + float velocityY = Main.rand.NextFloat(-15f, -8f); + Projectile.NewProjectile(projectile.oldPosition.X + (float)(projectile.width / 2), projectile.oldPosition.Y + (float)(projectile.height / 2), velocityX, velocityY, mod.ProjectileType("SpikecragSpike"), (int)((double)projectile.damage * 0.80), 0f, projectile.owner, 0f, 0f); + } + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.penetrate == 0) + { + projectile.Kill(); + } + return false; + } + + public override bool CanDamage() + { + return false; + } + } +} diff --git a/Projectiles/Summon/Spikecrag.png b/Projectiles/Summon/Spikecrag.png new file mode 100644 index 0000000000..045340012d Binary files /dev/null and b/Projectiles/Summon/Spikecrag.png differ diff --git a/Projectiles/Summon/SpikecragSpike.cs b/Projectiles/Summon/SpikecragSpike.cs new file mode 100644 index 0000000000..517f9ed397 --- /dev/null +++ b/Projectiles/Summon/SpikecragSpike.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class SpikecragSpike : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("SpikecragSpike"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.minion = true; + projectile.minionSlots = 0f; + projectile.penetrate = 1; + projectile.timeLeft = 600; + projectile.aiStyle = 1; + } + + public override void AI() + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.velocity.Y += 0.1f; + } + } +} \ No newline at end of file diff --git a/Projectiles/Summon/SpikecragSpike.png b/Projectiles/Summon/SpikecragSpike.png new file mode 100644 index 0000000000..28d252a6d7 Binary files /dev/null and b/Projectiles/Summon/SpikecragSpike.png differ diff --git a/Projectiles/Summon/Urchin.cs b/Projectiles/Summon/Urchin.cs index b7214b7ea7..47f769350b 100644 --- a/Projectiles/Summon/Urchin.cs +++ b/Projectiles/Summon/Urchin.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Urchin"); - Main.projPet[projectile.type] = true; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; } @@ -98,39 +97,18 @@ namespace CalamityMod.Projectiles.Summon return; } bool flag18 = false; - float num506 = projectile.Center.X; - float num507 = projectile.Center.Y; float num508 = 300f; - NPC ownerMinionAttackTargetNPC = projectile.OwnerMinionAttackTargetNPC; - if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(projectile, false)) + for (int num512 = 0; num512 < 200; num512++) { - float num509 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2); - float num510 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2); - float num511 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num509) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num510); - if (num511 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height)) + if (Main.npc[num512].CanBeChasedBy(projectile, false)) { - num508 = num511; - num506 = num509; - num507 = num510; - flag18 = true; - } - } - if (!flag18) - { - for (int num512 = 0; num512 < 200; num512++) - { - if (Main.npc[num512].CanBeChasedBy(projectile, false)) + float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); + float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); + float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); + if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) { - float num513 = Main.npc[num512].position.X + (float)(Main.npc[num512].width / 2); - float num514 = Main.npc[num512].position.Y + (float)(Main.npc[num512].height / 2); - float num515 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num513) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num514); - if (num515 < num508 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num512].position, Main.npc[num512].width, Main.npc[num512].height)) - { - num508 = num515; - num506 = num513; - num507 = num514; - flag18 = true; - } + num508 = num515; + flag18 = true; } } } diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index 42803d5ccf..25d24f3d3d 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -142,20 +142,37 @@ namespace CalamityMod.Projectiles.Summon { projectile.tileCollide = false; } - for (int num645 = 0; num645 < 200; num645++) + if (player.HasMinionAttackTargetNPC) { - NPC nPC2 = Main.npc[num645]; - if (nPC2.CanBeChasedBy(projectile, false)) + NPC npc = Main.npc[player.MinionAttackTargetNPC]; + if (npc.CanBeChasedBy(projectile, false)) { - float num646 = Vector2.Distance(nPC2.Center, projectile.Center); - if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + float num646 = Vector2.Distance(npc.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { num633 = num646; - vector46 = nPC2.Center; + vector46 = npc.Center; flag25 = true; } } } + else + { + for (int num645 = 0; num645 < 200; num645++) + { + NPC nPC2 = Main.npc[num645]; + if (nPC2.CanBeChasedBy(projectile, false)) + { + float num646 = Vector2.Distance(nPC2.Center, projectile.Center); + if (((Vector2.Distance(projectile.Center, vector46) > num646 && num646 < num633) || !flag25) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, nPC2.position, nPC2.width, nPC2.height)) + { + num633 = num646; + vector46 = nPC2.Center; + flag25 = true; + } + } + } + } float num647 = num634; if (flag25) { diff --git a/Projectiles/SunkenSea/ClamCrusherFlail.cs b/Projectiles/SunkenSea/ClamCrusherFlail.cs index 300c5bad7d..e418c1c97f 100644 --- a/Projectiles/SunkenSea/ClamCrusherFlail.cs +++ b/Projectiles/SunkenSea/ClamCrusherFlail.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Projectiles.SunkenSea projectile.melee = true; projectile.alpha = 255; projectile.tileCollide = false; + projectile.GetGlobalProjectile(mod).trueMelee = true; } public override void AI() diff --git a/Projectiles/SunkenSea/Shellfish.cs b/Projectiles/SunkenSea/Shellfish.cs index f039e70ad3..7f18cf7479 100644 --- a/Projectiles/SunkenSea/Shellfish.cs +++ b/Projectiles/SunkenSea/Shellfish.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.SunkenSea } if (projectile.ai[0] == 0f) { - projectile.damage = 100; + projectile.damage = 70; if (Main.player[projectile.owner].minionDamage != projectile.GetGlobalProjectile(mod).spawnedPlayerMinionDamageValue) { int damage2 = (int)(((float)projectile.GetGlobalProjectile(mod).spawnedPlayerMinionProjectileDamageValue / @@ -353,7 +353,7 @@ namespace CalamityMod.Projectiles.SunkenSea { flag54 = true; } - else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage) + else if (Main.npc[num989].active && !Main.npc[num989].dontTakeDamage && Main.npc[num989].defense < 9999) { projectile.Center = Main.npc[num989].Center - projectile.velocity * 2f; projectile.gfxOffY = Main.npc[num989].gfxOffY; @@ -382,7 +382,7 @@ namespace CalamityMod.Projectiles.SunkenSea { for (int i = 0; i < 200; i++) { - if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage)) && + if (((Main.npc[i].active && !Main.npc[i].dontTakeDamage && Main.npc[i].defense < 9999)) && ((projectile.friendly && (!Main.npc[i].friendly || projectile.type == 318 || (Main.npc[i].type == 22 && projectile.owner < 255 && Main.player[projectile.owner].killGuide) || (Main.npc[i].type == 54 && projectile.owner < 255 && Main.player[projectile.owner].killClothier))) || (projectile.hostile && Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles)) && (projectile.owner < 0 || Main.npc[i].immune[projectile.owner] == 0 || projectile.maxPenetrate == 1)) { diff --git a/Projectiles/Typeless/AstralSpray.cs b/Projectiles/Typeless/AstralSpray.cs index 638c0367c8..58cc969102 100644 --- a/Projectiles/Typeless/AstralSpray.cs +++ b/Projectiles/Typeless/AstralSpray.cs @@ -8,6 +8,8 @@ using Terraria.ModLoader; using Microsoft.Xna.Framework; +using CalamityMod.World; + namespace CalamityMod.Projectiles.Typeless { public class AstralSpray : ModProjectile @@ -36,7 +38,7 @@ namespace CalamityMod.Projectiles.Typeless { int x = (int)(projectile.Center.X / 16f); int y = (int)(projectile.Center.Y / 16f); - CalamityWorld.ConvertToAstral(x - 1, x + 1, y - 1, y + 1); + WorldGenerationMethods.ConvertToAstral(x - 1, x + 1, y - 1, y + 1); } if (projectile.timeLeft > 133) { diff --git a/Projectiles/Typeless/AtaxiaOrb.cs b/Projectiles/Typeless/AtaxiaOrb.cs index 19c753cd1d..f3e56e69a8 100644 --- a/Projectiles/Typeless/AtaxiaOrb.cs +++ b/Projectiles/Typeless/AtaxiaOrb.cs @@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.height = 4; projectile.friendly = true; projectile.penetrate = 1; + projectile.extraUpdates = 1; projectile.tileCollide = false; projectile.timeLeft = 200; } diff --git a/Projectiles/Typeless/PoisonousSeawater.cs b/Projectiles/Typeless/PoisonousSeawater.cs index 439d5d1bdb..0f31a193d8 100644 --- a/Projectiles/Typeless/PoisonousSeawater.cs +++ b/Projectiles/Typeless/PoisonousSeawater.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Typeless projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; + projectile.timeLeft = 6; } public override void AI() @@ -44,7 +45,7 @@ namespace CalamityMod.Projectiles.Typeless { randomDust = 89; } - for (int num468 = 0; num468 < 3; num468++) + for (int num468 = 0; num468 < 2; num468++) { int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default(Color), 1f); if (randomDust == 89) diff --git a/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs b/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs new file mode 100644 index 0000000000..2e76bef00c --- /dev/null +++ b/Projectiles/Typeless/TheDeadlyMicrobeProjectile.cs @@ -0,0 +1,203 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class TheDeadlyMicrobeProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Star"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 3600; + } + + public override void AI() + { + float num944 = 1f - (float)projectile.alpha / 255f; + num944 *= projectile.scale; + Lighting.AddLight(projectile.Center, 0.25f * num944, 0.025f * num944, 0.275f * num944); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 90f) + { + projectile.localAI[0] *= -1f; + } + if (projectile.localAI[0] >= 0f) + { + projectile.scale += 0.003f; + } + else + { + projectile.scale -= 0.003f; + } + projectile.rotation += 0.0025f * projectile.scale; + float num945 = 1f; + float num946 = 1f; + if (projectile.identity % 6 == 0) + { + num946 *= -1f; + } + if (projectile.identity % 6 == 1) + { + num945 *= -1f; + } + if (projectile.identity % 6 == 2) + { + num946 *= -1f; + num945 *= -1f; + } + if (projectile.identity % 6 == 3) + { + num946 = 0f; + } + if (projectile.identity % 6 == 4) + { + num945 = 0f; + } + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 60f) + { + projectile.localAI[1] = -180f; + } + if (projectile.localAI[1] >= -60f) + { + projectile.velocity.X = projectile.velocity.X + 0.002f * num946; + projectile.velocity.Y = projectile.velocity.Y + 0.002f * num945; + } + else + { + projectile.velocity.X = projectile.velocity.X - 0.002f * num946; + projectile.velocity.Y = projectile.velocity.Y - 0.002f * num945; + } + projectile.ai[0] += 1f; + if (projectile.ai[0] > 5400f) + { + projectile.damage = 0; + projectile.ai[1] = 1f; + if (projectile.alpha < 255) + { + projectile.alpha += 5; + if (projectile.alpha > 255) + { + projectile.alpha = 255; + } + } + else if (projectile.owner == Main.myPlayer) + { + projectile.Kill(); + } + } + else + { + float num947 = (projectile.Center - Main.player[projectile.owner].Center).Length() / 100f; + if (num947 > 4f) + { + num947 *= 1.1f; + } + if (num947 > 5f) + { + num947 *= 1.2f; + } + if (num947 > 6f) + { + num947 *= 1.3f; + } + if (num947 > 7f) + { + num947 *= 1.4f; + } + if (num947 > 8f) + { + num947 *= 1.5f; + } + if (num947 > 9f) + { + num947 *= 1.6f; + } + if (num947 > 10f) + { + num947 *= 1.7f; + } + projectile.ai[0] += num947; + if (projectile.alpha > 50) + { + projectile.alpha -= 10; + if (projectile.alpha < 50) + { + projectile.alpha = 50; + } + } + } + bool flag49 = false; + Vector2 center12 = new Vector2(0f, 0f); + float num948 = 600f; + for (int num949 = 0; num949 < 200; num949++) + { + if (Main.npc[num949].CanBeChasedBy(projectile, false)) + { + float num950 = Main.npc[num949].position.X + (float)(Main.npc[num949].width / 2); + float num951 = Main.npc[num949].position.Y + (float)(Main.npc[num949].height / 2); + float num952 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num950) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num951); + if (num952 < num948) + { + num948 = num952; + center12 = Main.npc[num949].Center; + flag49 = true; + } + } + } + if (flag49) + { + Vector2 vector101 = center12 - projectile.Center; + vector101.Normalize(); + vector101 *= 0.75f; + projectile.velocity = (projectile.velocity * 10f + vector101) / 11f; + return; + } + if ((double)projectile.velocity.Length() > 0.2) + { + projectile.velocity *= 0.98f; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 180); + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = (projectile.height = 56); + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default(Vector2)) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 44, vector7.X, vector7.Y, 100, default(Color), 0.5f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + projectile.Damage(); + } + } +} \ No newline at end of file diff --git a/Sounds/Item/KendraBark.cs b/Sounds/Item/KendraBark.cs new file mode 100644 index 0000000000..cf3e3e1422 --- /dev/null +++ b/Sounds/Item/KendraBark.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Item +{ + public class KendraBark : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} \ No newline at end of file diff --git a/Sounds/Item/KendraBark.wav b/Sounds/Item/KendraBark.wav new file mode 100644 index 0000000000..18e700e582 Binary files /dev/null and b/Sounds/Item/KendraBark.wav differ diff --git a/Tiles/AerialiteBrick.cs b/Tiles/AerialiteBrick.cs index ea705364df..f953908cf4 100644 --- a/Tiles/AerialiteBrick.cs +++ b/Tiles/AerialiteBrick.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; + Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; TileID.Sets.NeedsGrassFraming[Type] = true; soundType = 21; diff --git a/Tiles/AstralBrick.cs b/Tiles/AstralBrick.cs index dfd57592fd..f6e870302b 100644 --- a/Tiles/AstralBrick.cs +++ b/Tiles/AstralBrick.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; + Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; TileID.Sets.NeedsGrassFraming[Type] = true; soundType = 21; diff --git a/Tiles/AstralDesert/AstralSand.png b/Tiles/AstralDesert/AstralSand.png index e24ef7168e..67a7ab9aed 100644 Binary files a/Tiles/AstralDesert/AstralSand.png and b/Tiles/AstralDesert/AstralSand.png differ diff --git a/Tiles/AstralDesert/AstralSandstone.png b/Tiles/AstralDesert/AstralSandstone.png index 800db7d5af..f7963a9400 100644 Binary files a/Tiles/AstralDesert/AstralSandstone.png and b/Tiles/AstralDesert/AstralSandstone.png differ diff --git a/Tiles/AstralDesert/HardenedAstralSand.png b/Tiles/AstralDesert/HardenedAstralSand.png index ef1eb1c408..8e88c8dc9c 100644 Binary files a/Tiles/AstralDesert/HardenedAstralSand.png and b/Tiles/AstralDesert/HardenedAstralSand.png differ diff --git a/Tiles/AstralMonolith.cs b/Tiles/AstralMonolith.cs index 85c47b9eea..bafe99a559 100644 --- a/Tiles/AstralMonolith.cs +++ b/Tiles/AstralMonolith.cs @@ -34,6 +34,10 @@ namespace CalamityMod.Tiles public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (!Lighting.NotRetro) + { + return; + } int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; int xOffset = i % 4; diff --git a/Tiles/AstralSnow/AstralIce.png b/Tiles/AstralSnow/AstralIce.png index 42b7ec1478..20cad6cec1 100644 Binary files a/Tiles/AstralSnow/AstralIce.png and b/Tiles/AstralSnow/AstralIce.png differ diff --git a/Tiles/ChaoticOre.cs b/Tiles/ChaoticOre.cs index 13e7793498..5e936396fc 100644 --- a/Tiles/ChaoticOre.cs +++ b/Tiles/ChaoticOre.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Tiles Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + Main.tileValue[Type] = 750; dustType = 105; drop = mod.ItemType("ChaoticOre"); ModTranslation name = CreateMapEntryName(); @@ -23,11 +24,6 @@ namespace CalamityMod.Tiles soundType = 21; } - public override void RandomUpdate(int i, int j) - { - Main.tileValue[Type] = (short)(Main.hardMode ? 750 : 0); - } - public override void NearbyEffects(int i, int j, bool closer) { if (!closer && j < Main.maxTilesY - 205) diff --git a/Tiles/CharredOre.cs b/Tiles/CharredOre.cs index d382838be5..9d1ec5755e 100644 --- a/Tiles/CharredOre.cs +++ b/Tiles/CharredOre.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Tiles Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; Main.tileLighted[Type] = true; - drop = mod.ItemType("CharredOre"); + Main.tileValue[Type] = 710; + drop = mod.ItemType("CharredOre"); ModTranslation name = CreateMapEntryName(); name.SetDefault("Charred Ore"); AddMapEntry(new Color(128, 0, 0), name); @@ -23,11 +24,6 @@ namespace CalamityMod.Tiles Main.tileSpelunker[Type] = true; } - public override void RandomUpdate(int i, int j) - { - Main.tileValue[Type] = (short)(Main.hardMode ? 710 : 0); - } - public override bool CanExplode(int i, int j) { return NPC.downedPlantBoss; diff --git a/Tiles/Cinderplate.cs b/Tiles/Cinderplate.cs index c40f3d0e2a..1e824f8f67 100644 --- a/Tiles/Cinderplate.cs +++ b/Tiles/Cinderplate.cs @@ -17,8 +17,9 @@ namespace CalamityMod.Tiles { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + Main.tileValue[Type] = 750; - ModTranslation name = CreateMapEntryName(); + ModTranslation name = CreateMapEntryName(); name.SetDefault("Cinderplate"); AddMapEntry(new Color(97, 22, 57), name); diff --git a/Tiles/Cinderplate.png b/Tiles/Cinderplate.png index 616f5e4692..2d9c88899b 100644 Binary files a/Tiles/Cinderplate.png and b/Tiles/Cinderplate.png differ diff --git a/Tiles/CorruptionEffigy.cs b/Tiles/CorruptionEffigy.cs new file mode 100644 index 0000000000..6a05198464 --- /dev/null +++ b/Tiles/CorruptionEffigy.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class CorruptionEffigy : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.Width = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Corruption Effigy"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("CorruptionEffigyBuff"), 20); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("CorruptionEffigy")); + } + } +} \ No newline at end of file diff --git a/Tiles/CorruptionEffigy.png b/Tiles/CorruptionEffigy.png new file mode 100644 index 0000000000..2f10d31098 Binary files /dev/null and b/Tiles/CorruptionEffigy.png differ diff --git a/Tiles/CrimsonEffigy.cs b/Tiles/CrimsonEffigy.cs new file mode 100644 index 0000000000..e78b9a1c83 --- /dev/null +++ b/Tiles/CrimsonEffigy.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles +{ + public class CrimsonEffigy : ModTile + { + public override void SetDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.Width = 2; + TileObjectData.addTile(Type); + ModTranslation name = CreateMapEntryName(); + name.SetDefault("Crimson Effigy"); + AddMapEntry(new Color(238, 145, 105), name); + } + + public override void NearbyEffects(int i, int j, bool closer) + { + Player player = Main.LocalPlayer; + if (!player.dead && player.active) + player.AddBuff(mod.BuffType("CrimsonEffigyBuff"), 20); + } + + public override void KillMultiTile(int i, int j, int frameX, int frameY) + { + Item.NewItem(i * 16, j * 16, 48, 32, mod.ItemType("CrimsonEffigy")); + } + } +} \ No newline at end of file diff --git a/Tiles/CrimsonEffigy.png b/Tiles/CrimsonEffigy.png new file mode 100644 index 0000000000..ef06cd32e7 Binary files /dev/null and b/Tiles/CrimsonEffigy.png differ diff --git a/Tiles/CryonicOre.cs b/Tiles/CryonicOre.cs index 5b1b5bc9ad..da9e9b2e31 100644 --- a/Tiles/CryonicOre.cs +++ b/Tiles/CryonicOre.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Tiles Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + Main.tileValue[Type] = 675; dustType = mod.DustType("MSparkle"); drop = mod.ItemType("CryonicOre"); ModTranslation name = CreateMapEntryName(); @@ -24,11 +25,6 @@ namespace CalamityMod.Tiles Main.tileSpelunker[Type] = true; } - public override void RandomUpdate(int i, int j) - { - Main.tileValue[Type] = (short)(Main.hardMode ? 675 : 0); - } - public override bool CanExplode(int i, int j) { return CalamityWorld.downedCryogen; diff --git a/Tiles/ExodiumOre.cs b/Tiles/ExodiumOre.cs index c2a0dd2e80..3a2ad6d819 100644 --- a/Tiles/ExodiumOre.cs +++ b/Tiles/ExodiumOre.cs @@ -17,15 +17,14 @@ namespace CalamityMod.Tiles { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - ModTranslation name = CreateMapEntryName(); name.SetDefault("Exodium Ore"); AddMapEntry(new Color(51, 48, 68), name); - - minPick = 0; - Main.tileValue[Type] = 450; + mineResist = 5f; + minPick = 224; + soundType = 21; + Main.tileValue[Type] = 760; Main.tileSpelunker[Type] = true; - drop = mod.ItemType("ExodiumClusterOre"); base.SetDefaults(); } diff --git a/Tiles/FurnitureAbyss/SmoothAbyssGravel.png b/Tiles/FurnitureAbyss/SmoothAbyssGravel.png index 336ef18951..50d6cd3051 100644 Binary files a/Tiles/FurnitureAbyss/SmoothAbyssGravel.png and b/Tiles/FurnitureAbyss/SmoothAbyssGravel.png differ diff --git a/Tiles/FurnitureAshen/AshenSlab.cs b/Tiles/FurnitureAshen/AshenSlab.cs index 38a3d4fc8a..27c91cd5ad 100644 --- a/Tiles/FurnitureAshen/AshenSlab.cs +++ b/Tiles/FurnitureAshen/AshenSlab.cs @@ -387,6 +387,10 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (!Lighting.NotRetro) + { + return; + } int uniqueAnimationFrameX = Main.tileFrame[Type] + i; int uniqueAnimationFrameY = Main.tileFrame[Type] + j; int xOffset = 0; //Used to shift the pattern tiles patterns diff --git a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs index 69fb31c7aa..ffe0bd8ed5 100644 --- a/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs +++ b/Tiles/FurnitureAshen/SmoothBrimstoneSlag.cs @@ -29,30 +29,31 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - if (Main.tile[i, j].type == mod.TileType("SmoothBrimstoneSlag")) + if (!Lighting.NotRetro) { - int xPos = Main.tile[i, j].frameX; - int yPos = Main.tile[i, j].frameY; - Texture2D glowmask = mod.GetTexture("Tiles/FurnitureAshen/SmoothBrimstoneSlag_Glowmask"); - //Initialize the default draw offset of the post drawn sections, then update it to not have the 4 tile offset if camera mode is enabled - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X + GetDrawOffset(), j * 16 - Main.screenPosition.Y + GetDrawOffset()); - if (CaptureManager.Instance.IsCapturing) - { - drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y); - } - spriteBatch.Draw - ( - glowmask, - drawOffset, - new Rectangle(xPos, yPos, 18, 18), - new Color(25, 25, 25, 25), - 0, - new Vector2(0f, 0f), - 1, - SpriteEffects.None, - 0f - ); + return; } + int xPos = Main.tile[i, j].frameX; + int yPos = Main.tile[i, j].frameY; + Texture2D glowmask = mod.GetTexture("Tiles/FurnitureAshen/SmoothBrimstoneSlag_Glowmask"); + //Initialize the default draw offset of the post drawn sections, then update it to not have the 4 tile offset if camera mode is enabled + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X + GetDrawOffset(), j * 16 - Main.screenPosition.Y + GetDrawOffset()); + if (CaptureManager.Instance.IsCapturing) + { + drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y); + } + spriteBatch.Draw + ( + glowmask, + drawOffset, + new Rectangle(xPos, yPos, 18, 18), + new Color(25, 25, 25, 25), + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); } /// diff --git a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs index 4d464a38f3..ffe27e65fc 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBrick.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBrick.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; + Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; TileID.Sets.NeedsGrassFraming[Type] = true; soundType = 21; @@ -32,6 +32,10 @@ namespace CalamityMod.Tiles.FurnitureCosmilite public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (!Lighting.NotRetro) + { + return; + } int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; Texture2D glowmask = mod.GetTexture("Tiles/FurnitureCosmilite/CosmiliteBrick_Glowmask"); diff --git a/Tiles/FurnitureOccult/OccultStone.cs b/Tiles/FurnitureOccult/OccultStone.cs index 8e19428af3..0f21846b79 100644 --- a/Tiles/FurnitureOccult/OccultStone.cs +++ b/Tiles/FurnitureOccult/OccultStone.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.FurnitureOccult Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; soundType = 21; - mineResist = 10f; + mineResist = 5f; minPick = 200; drop = mod.ItemType("OccultStone"); AddMapEntry(new Color(60, 42, 61)); @@ -202,6 +202,11 @@ namespace CalamityMod.Tiles.FurnitureOccult public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (!Lighting.NotRetro) + { + return; + } + //Initialize the default draw offset of the post drawn sections, then update it to not have the 4 tile offset if camera mode is enabled //Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X + (Main.screenWidth / 30), j * 16 - Main.screenPosition.Y + (Main.screenWidth / 30)); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X + GetDrawOffset(), j * 16 - Main.screenPosition.Y + GetDrawOffset()); diff --git a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs index 0374e0f067..70d878a4fc 100644 --- a/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs +++ b/Tiles/FurniturePlaguedPlate/PlaguedPlate.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; + Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; TileID.Sets.NeedsGrassFraming[Type] = true; soundType = 21; @@ -35,6 +35,10 @@ namespace CalamityMod.Tiles.FurniturePlaguedPlate public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (!Lighting.NotRetro) + { + return; + } int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; Texture2D glowmask = mod.GetTexture("Tiles/FurniturePlaguedPlate/PlaguedPlate_Glowmask"); diff --git a/Tiles/FurnitureProfaned/ProfanedRock.cs b/Tiles/FurnitureProfaned/ProfanedRock.cs index e233767d98..244066e6c9 100644 --- a/Tiles/FurnitureProfaned/ProfanedRock.cs +++ b/Tiles/FurnitureProfaned/ProfanedRock.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; soundType = 21; - mineResist = 15f; + mineResist = 10f; minPick = 225; drop = mod.ItemType("ProfanedRock"); AddMapEntry(new Color(84, 38, 33)); @@ -122,6 +122,10 @@ namespace CalamityMod.Tiles.FurnitureProfaned public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (!Lighting.NotRetro) + { + return; + } int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; int xOffset = 0; diff --git a/Tiles/FurnitureProfaned/ProfanedSlab.cs b/Tiles/FurnitureProfaned/ProfanedSlab.cs index a5c90775cf..3de7c3f7de 100644 --- a/Tiles/FurnitureProfaned/ProfanedSlab.cs +++ b/Tiles/FurnitureProfaned/ProfanedSlab.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; soundType = 21; - mineResist = 10f; + mineResist = 5f; minPick = 225; drop = mod.ItemType("ProfanedSlab"); AddMapEntry(new Color(122, 66, 59)); diff --git a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs index 6571d55e43..cd0f57e650 100644 --- a/Tiles/FurnitureProfaned/RunicProfanedBrick.cs +++ b/Tiles/FurnitureProfaned/RunicProfanedBrick.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Tiles.FurnitureProfaned Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; soundType = 21; - mineResist = 10f; + mineResist = 5f; minPick = 225; drop = mod.ItemType("RunicProfanedBrick"); AddMapEntry(new Color(122, 66, 59)); diff --git a/Tiles/FurnitureSilva/SilvaCrystal.cs b/Tiles/FurnitureSilva/SilvaCrystal.cs index b57e85ed95..3bb8bbecf7 100644 --- a/Tiles/FurnitureSilva/SilvaCrystal.cs +++ b/Tiles/FurnitureSilva/SilvaCrystal.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Tiles.FurnitureSilva public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; + Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; TileID.Sets.NeedsGrassFraming[Type] = true; soundType = 21; diff --git a/Tiles/FurnitureStratus/StratusBricks.cs b/Tiles/FurnitureStratus/StratusBricks.cs index 0c6749ec13..0fd5d4d096 100644 --- a/Tiles/FurnitureStratus/StratusBricks.cs +++ b/Tiles/FurnitureStratus/StratusBricks.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void SetDefaults() { Main.tileSolid[Type] = true; - Main.tileMergeDirt[Type] = true; + Main.tileMergeDirt[Type] = false; Main.tileBlockLight[Type] = true; Main.tileBrick[Type] = true; TileID.Sets.NeedsGrassFraming[Type] = true; @@ -32,6 +32,10 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (!Lighting.NotRetro) + { + return; + } int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; Texture2D glowmask = mod.GetTexture("Tiles/FurnitureStratus/StratusBricks_Glowmask"); diff --git a/Tiles/FurnitureVoid/SmoothVoidstone.cs b/Tiles/FurnitureVoid/SmoothVoidstone.cs index c083278209..a699362b80 100644 --- a/Tiles/FurnitureVoid/SmoothVoidstone.cs +++ b/Tiles/FurnitureVoid/SmoothVoidstone.cs @@ -120,6 +120,10 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (!Lighting.NotRetro) + { + return; + } int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; int xOffset = 0; diff --git a/Tiles/FurnitureVoid/SmoothVoidstone.png b/Tiles/FurnitureVoid/SmoothVoidstone.png index 35394cb40d..47f5844086 100644 Binary files a/Tiles/FurnitureVoid/SmoothVoidstone.png and b/Tiles/FurnitureVoid/SmoothVoidstone.png differ diff --git a/Tiles/FurnitureVoid/SmoothVoidstone_Glowmask.png b/Tiles/FurnitureVoid/SmoothVoidstone_Glowmask.png index b624742af1..eae31d435a 100644 Binary files a/Tiles/FurnitureVoid/SmoothVoidstone_Glowmask.png and b/Tiles/FurnitureVoid/SmoothVoidstone_Glowmask.png differ diff --git a/Tiles/FurnitureVoid/VoidstoneSlab.cs b/Tiles/FurnitureVoid/VoidstoneSlab.cs index cf5968e8dd..8e53951848 100644 --- a/Tiles/FurnitureVoid/VoidstoneSlab.cs +++ b/Tiles/FurnitureVoid/VoidstoneSlab.cs @@ -92,6 +92,10 @@ namespace CalamityMod.Tiles.FurnitureVoid public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (!Lighting.NotRetro) + { + return; + } int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; int yOffset = 0; diff --git a/Tiles/HallowedOre.png b/Tiles/HallowedOre.png new file mode 100644 index 0000000000..35867adf23 Binary files /dev/null and b/Tiles/HallowedOre.png differ diff --git a/Tiles/PerennialOre.cs b/Tiles/PerennialOre.cs index b1e7b5c989..63afab584a 100644 --- a/Tiles/PerennialOre.cs +++ b/Tiles/PerennialOre.cs @@ -13,6 +13,7 @@ namespace CalamityMod.Tiles Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + Main.tileValue[Type] = 690; dustType = mod.DustType("CESparkle"); drop = mod.ItemType("PerennialOre"); ModTranslation name = CreateMapEntryName(); @@ -24,11 +25,6 @@ namespace CalamityMod.Tiles Main.tileSpelunker[Type] = true; } - public override void RandomUpdate(int i, int j) - { - Main.tileValue[Type] = (short)(Main.hardMode ? 690 : 0); - } - public override bool CanExplode(int i, int j) { return NPC.downedPlantBoss; diff --git a/Tiles/SulphurousSand.png b/Tiles/SulphurousSand.png index 5e9a1bf07b..80cf291f2a 100644 Binary files a/Tiles/SulphurousSand.png and b/Tiles/SulphurousSand.png differ diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index f7630a1738..cbfb24aded 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -201,6 +201,11 @@ namespace CalamityMod.Tiles public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (!Lighting.NotRetro) + { + return; + } + //Initialize the default draw offset of the post drawn sections, then update it to not have the 4 tile offset if camera mode is enabled //Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X + (Main.screenWidth / 30), j * 16 - Main.screenPosition.Y + (Main.screenWidth / 30)); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X + GetDrawOffset(), j * 16 - Main.screenPosition.Y + GetDrawOffset()); diff --git a/Tiles/UelibloomOre.cs b/Tiles/UelibloomOre.cs index 7430f7cc0a..ab27b49856 100644 --- a/Tiles/UelibloomOre.cs +++ b/Tiles/UelibloomOre.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Tiles Main.tileSolid[Type] = true; Main.tileMergeDirt[Type] = true; Main.tileBlockLight[Type] = true; + Main.tileValue[Type] = 805; dustType = mod.DustType("TCESparkle"); drop = mod.ItemType("UelibloomOre"); ModTranslation name = CreateMapEntryName(); @@ -23,11 +24,6 @@ namespace CalamityMod.Tiles Main.tileSpelunker[Type] = true; } - public override void RandomUpdate(int i, int j) - { - Main.tileValue[Type] = (short)(Main.hardMode ? 805 : 0); - } - public override bool CanExplode(int i, int j) { return NPC.downedMoonlord; diff --git a/Tiles/Voidstone.cs b/Tiles/Voidstone.cs index c4bd265981..d561f19f69 100644 --- a/Tiles/Voidstone.cs +++ b/Tiles/Voidstone.cs @@ -198,6 +198,10 @@ namespace CalamityMod.Tiles public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (!Lighting.NotRetro) + { + return; + } int xPos = Main.tile[i, j].frameX; int yPos = Main.tile[i, j].frameY; int xOffset = 0; diff --git a/Tiles/Voidstone.png b/Tiles/Voidstone.png index a91bec452c..f70ab3aebd 100644 Binary files a/Tiles/Voidstone.png and b/Tiles/Voidstone.png differ diff --git a/Tiles/Voidstone_Glowmask.png b/Tiles/Voidstone_Glowmask.png index bc64805302..b252e4f20b 100644 Binary files a/Tiles/Voidstone_Glowmask.png and b/Tiles/Voidstone_Glowmask.png differ diff --git a/Walls/AstralIceWall.png b/Walls/AstralIceWall.png index f01257603b..408b4bfa26 100644 Binary files a/Walls/AstralIceWall.png and b/Walls/AstralIceWall.png differ diff --git a/Walls/AstralSandstoneWall.png b/Walls/AstralSandstoneWall.png index 8e9fb8711b..bb50346ccc 100644 Binary files a/Walls/AstralSandstoneWall.png and b/Walls/AstralSandstoneWall.png differ diff --git a/Walls/CinderplateWall.png b/Walls/CinderplateWall.png index cf51bd66f0..8b1513dfdf 100644 Binary files a/Walls/CinderplateWall.png and b/Walls/CinderplateWall.png differ diff --git a/Walls/EutrophicSandWall.cs b/Walls/EutrophicSandWall.cs index 0d15d3f9bb..874d78454b 100644 --- a/Walls/EutrophicSandWall.cs +++ b/Walls/EutrophicSandWall.cs @@ -11,7 +11,16 @@ namespace CalamityMod.Walls dustType = 108; } - public override void NumDust(int i, int j, bool fail, ref int num) + public override void RandomUpdate(int i, int j) + { + if (Main.tile[i, j].liquid <= 0) + { + Main.tile[i, j].liquid = 255; + Main.tile[i, j].lava(false); + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; } diff --git a/Walls/HardenedAstralSandWall.png b/Walls/HardenedAstralSandWall.png index dd04e0127f..d69aec2968 100644 Binary files a/Walls/HardenedAstralSandWall.png and b/Walls/HardenedAstralSandWall.png differ diff --git a/Walls/SmoothAbyssGravelWall.png b/Walls/SmoothAbyssGravelWall.png index 687756a981..b4846b0e9a 100644 Binary files a/Walls/SmoothAbyssGravelWall.png and b/Walls/SmoothAbyssGravelWall.png differ diff --git a/Walls/SmoothVoidstoneWall.png b/Walls/SmoothVoidstoneWall.png index 6f3c7d384e..c3e9c1c027 100644 Binary files a/Walls/SmoothVoidstoneWall.png and b/Walls/SmoothVoidstoneWall.png differ diff --git a/Walls/VoidstoneWall.png b/Walls/VoidstoneWall.png index 9f61fdd8e3..f7a61916b4 100644 Binary files a/Walls/VoidstoneWall.png and b/Walls/VoidstoneWall.png differ diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 7374e343ed..5c0e4f3a81 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -385,7 +385,7 @@ namespace CalamityMod.World new Actions.SetFrames(true) })); } - point = new Point(WorldGen.genRand.Next(WorldGen.UndergroundDesertLocation.Left + 20, WorldGen.UndergroundDesertLocation.Right - 20), + point = new Point(WorldGen.genRand.Next(WorldGen.UndergroundDesertLocation.Left + 30, WorldGen.UndergroundDesertLocation.Right - 30), WorldGen.genRand.Next(WorldGen.UndergroundDesertLocation.Bottom + 20, sunkenSeaBottom)); if (smallHoles < amt && WorldGen.genRand.Next(3) == 0 && !rectangle.Contains(point)) { @@ -544,7 +544,7 @@ namespace CalamityMod.World { if (WorldGen.genRand.Next(5) == 0) { - CalamityWorld.PlaceTit(num5, num6, (ushort)mod.TileType("SunkenSeaStalactite")); + WorldGenerationMethods.PlaceTit(num5, num6, (ushort)mod.TileType("SunkenSeaStalactite")); } if (WorldGen.genRand.Next(8) == 0) { diff --git a/World/WorldGenerationMethods.cs b/World/WorldGenerationMethods.cs new file mode 100644 index 0000000000..0e5aaa3061 --- /dev/null +++ b/World/WorldGenerationMethods.cs @@ -0,0 +1,3249 @@ +using System; +using System.IO; +using System.Linq; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.World.Generation; +using Terraria.Graphics.Effects; +using Terraria.GameContent.Generation; +using Terraria.IO; +using Terraria.Localization; +using Terraria.GameContent.Events; +using Terraria.ModLoader.IO; +using CalamityMod.Tiles; +using CalamityMod.NPCs; +using CalamityMod.World; +using CalamityMod.World.Planets; + +namespace CalamityMod.World +{ + public class WorldGenerationMethods : ModWorld + { + #region BiomeChests + public static void GenerateBiomeChests(GenerationProgress progress) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + // Get dungeon size field infos. These fields are private for some reason + int MinX = (int)typeof(WorldGen).GetField("dMinX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) + 25; + int MaxX = (int)typeof(WorldGen).GetField("dMaxX", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; + int MaxY = (int)typeof(WorldGen).GetField("dMaxY", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) - 25; + int[] ChestTypes = new int[] { mod.TileType("AstralChestLocked") }; + int[] ItemTypes = new int[] { mod.ItemType("HeavenfallenStardisk") }; + + progress.Message = "Calamity Mod: Biome Chests"; + + int rounds = 1; + for (int i = 0; i < ChestTypes.Length * rounds; i++) + { + Chest chest = null; + int attempts = 0; + while (chest == null && attempts < 1000) + { + attempts++; + int x = WorldGen.genRand.Next(MinX, MaxX); + int y = WorldGen.genRand.Next((int)Main.worldSurface, MaxY); + if (Main.wallDungeon[Main.tile[x, y].wall] && !Main.tile[x, y].active()) + { + chest = AddChestWithDefaultLoot(x, y, (ushort)ChestTypes[i % ChestTypes.Length], 1, 2); + } + } + if (chest != null) + { + chest.item[0].SetDefaults(ItemTypes[i % ChestTypes.Length]); + chest.item[0].Prefix(-1); + } + } + } + + internal static Chest AddChestWithDefaultLoot(int i, int j, ushort type = TileID.Containers, uint emptySlots = 1, int Style = 0) + { + Chest chest = null; + while (j < Main.maxTilesY - 210) + { + if (!WorldGen.SolidTile(i, j)) + { + j++; + continue; + } + int chestIndex = WorldGen.PlaceChest(i - 1, j - 1, type, false, Style); + if (chestIndex < 0) + { + break; + } + chest = Main.chest[chestIndex]; + uint itemIndex = emptySlots; + while (itemIndex == emptySlots) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + bool AstralChest = type == mod.TileType("AstralChestLocked"); + int cItem; + cItem = WorldGen.genRand.NextBool() ? WorldGen.goldBar : WorldGen.silverBar; + int addAmount = 0; + if (AstralChest) + { + cItem = mod.ItemType("AstralBar"); + addAmount = 4; + } + chest.item[itemIndex].SetDefaults(cItem, false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(3 + addAmount, 11 + addAmount * 2); + itemIndex++; + if (WorldGen.genRand.NextBool()) + { + cItem = ItemID.HolyArrow; + int addAmount2 = 0; + if (AstralChest) + addAmount2 = 25; + chest.item[itemIndex].SetDefaults(cItem, false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(25 + addAmount2, 51 + addAmount2 * 2); + itemIndex++; + } + if (AstralChest) + { + chest.item[itemIndex].SetDefaults(mod.ItemType("AstralJelly"), false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(3, 6); + itemIndex++; + } + if (WorldGen.genRand.NextBool()) + { + int[] items = new int[] { + ItemID.SpelunkerPotion, ItemID.FeatherfallPotion, ItemID.NightOwlPotion, + ItemID.WaterWalkingPotion, ItemID.ArcheryPotion, ItemID.GravitationPotion + }; + if (AstralChest) + { + items[1] = mod.ItemType("RevivifyPotion"); + items[4] = ItemID.ShinePotion; + items[5] = ItemID.HunterPotion; + } + chest.item[itemIndex].SetDefaults(WorldGen.genRand.Next(items), false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3); + itemIndex++; + } + if (WorldGen.genRand.NextBool()) + { + int[] items = new int[] { + ItemID.ThornsPotion, ItemID.WaterWalkingPotion, ItemID.InvisibilityPotion, + ItemID.ManaRegenerationPotion, ItemID.TeleportationPotion, ItemID.TrapsightPotion, ItemID.TrapsightPotion // yes, dangersense potions have double the chance as other potions in vanilla for some reason + }; + if (AstralChest) + { + items[1] = ItemID.MagicPowerPotion; + items[2] = mod.ItemType("ZenPotion"); + items[5] = mod.ItemType("CadencePotion"); + } + chest.item[itemIndex].SetDefaults(WorldGen.genRand.Next(items), false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3); + itemIndex++; + } + if (WorldGen.genRand.NextBool()) + { + cItem = ItemID.RecallPotion; + int addAmount2 = 0; + if (AstralChest) + { + cItem = ItemID.BouncyDynamite; + addAmount2 = 2; + } + chest.item[itemIndex].SetDefaults(cItem, false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3) * addAmount2; + itemIndex++; + } + if (AstralChest) + addAmount = 2; + chest.item[itemIndex].SetDefaults(ItemID.GoldCoin, false); + chest.item[itemIndex].stack = WorldGen.genRand.Next(1, 3) * addAmount; + itemIndex++; + } + } + return chest; + } + #endregion + + #region SafeTileFrame + public static void SafeSquareTileFrame(int i, int j, bool resetFrame = true) + { + if (Main.tile[i, j] != null) + { + for (int x = i - 1; x <= i + 1; x++) + { + for (int y = j - 1; y <= j + 1; y++) + { + if (x < 0 || y < 0 || x >= Main.maxTilesX || y >= Main.maxTilesY) continue; + if (x == i && y == j) + { + WorldGen.TileFrame(i, j, resetFrame, false); + } + else + { + WorldGen.TileFrame(x, y, false, false); + } + } + } + } + } + #endregion + + #region ShuffleArray + public static int[] ShuffleArray(int[] array) + { + Random random = new Random(); + for (int index = array.Length; index > 0; index--) + { + int j = random.Next(index); + int k = array[j]; + array[j] = array[index - 1]; + array[index - 1] = k; + } + return array; + } + #endregion + + #region OreSpawn + public static void spawnOre(int type, double frequency, float depth, float depthLimit) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int x = Main.maxTilesX; + int y = Main.maxTilesY; + if (type == mod.TileType("ExodiumOre")) + { + depthLimit = 0.14f; + if (y > 1500) { depthLimit = 0.1f; if (y > 2100) { depthLimit = 0.07f; } } + } + if (Main.netMode != 1) + { + for (int k = 0; k < (int)((double)(x * y) * frequency); k++) + { + int tilesX = WorldGen.genRand.Next(0, x); + int tilesY = WorldGen.genRand.Next((int)(y * depth), (int)(y * depthLimit)); + if (type == mod.TileType("AuricOre")) + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(12, 18), WorldGen.genRand.Next(12, 18), (ushort)type); + } + else if (type == mod.TileType("UelibloomOre")) + { + if (Main.tile[tilesX, tilesY].type == 59) + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + } + else if (type == mod.TileType("PerennialOre")) + { + if (Main.tile[tilesX, tilesY].type == 0 || Main.tile[tilesX, tilesY].type == 1) + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + } + else if (type == mod.TileType("CryonicOre")) + { + if (Main.tile[tilesX, tilesY].type == 147 || Main.tile[tilesX, tilesY].type == 161 || Main.tile[tilesX, tilesY].type == 163 || Main.tile[tilesX, tilesY].type == 164 || Main.tile[tilesX, tilesY].type == 200) + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + } + else + { + WorldGen.OreRunner(tilesX, tilesY, (double)WorldGen.genRand.Next(3, 8), WorldGen.genRand.Next(3, 8), (ushort)type); + } + } + } + } + #endregion + + #region AstralMeteor + public static bool checkAstralMeteor() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int num = 0; + float num2 = (float)(Main.maxTilesX / 4200); + int num3 = (int)(200f * num2); //Small = 201 Medium = 305 Large = 401 + for (int j = 5; j < Main.maxTilesX - 5; j++) + { + int num4 = 5; + while ((double)num4 < Main.worldSurface) + { + if (Main.tile[j, num4].active() && Main.tile[j, num4].type == mod.TileType("AstralOre")) + { + num++; + if (num > num3) + { + return false; + } + } + num4++; + } + } + return true; + } + + public static bool checkAstralBiomeSpawn() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int num = 0; + float num2 = (float)(Main.maxTilesX / 4200); + int num3 = (int)(400f * num2); //Small = 401 Medium = 605 Large = 801 + for (int j = 5; j < Main.maxTilesX - 5; j++) + { + int num4 = 5; + while ((double)num4 < Main.worldSurface) + { + if (Main.tile[j, num4].active() && + (Main.tile[j, num4].type == mod.TileType("AstralSand") || Main.tile[j, num4].type == mod.TileType("AstralSandstone") || + Main.tile[j, num4].type == mod.TileType("HardenedAstralSand") || Main.tile[j, num4].type == mod.TileType("AstralIce") || + Main.tile[j, num4].type == mod.TileType("AstralDirt") || Main.tile[j, num4].type == mod.TileType("AstralStone") || + Main.tile[j, num4].type == mod.TileType("AstralGrass"))) + { + num++; + if (num > num3) + { + return false; + } + } + num4++; + } + } + return true; + } + + public static void dropAstralMeteor() + { + Mod mod = ModLoader.GetMod("CalamityMod"); + Mod ancientsAwakened = ModLoader.GetMod("AAMod"); + bool flag = true; + if (Main.netMode == 1) + { + return; + } + for (int i = 0; i < 255; i++) + { + if (Main.player[i].active) + { + flag = false; + break; + } + } + if (!checkAstralMeteor()) + { + return; + } + float num5 = 600f; + while (!flag) + { + float num6 = (float)Main.maxTilesX * 0.08f; + int xLimit = Main.maxTilesX / 2; + int num7 = (CalamityWorld.abyssSide ? Main.rand.Next(400, xLimit) : Main.rand.Next(xLimit, Main.maxTilesX - 400)); + while ((float)num7 > (float)Main.spawnTileX - num6 && (float)num7 < (float)Main.spawnTileX + num6) + { + num7 = (CalamityWorld.abyssSide ? Main.rand.Next(400, xLimit) : Main.rand.Next(xLimit, Main.maxTilesX - 400)); + } + //world surface = 920 large 740 medium 560 small + int k = (int)(Main.worldSurface * 0.5); //Large = 522, Medium = 444, Small = 336 + while (k < Main.maxTilesY) + { + if (Main.tile[num7, k].active() && Main.tileSolid[(int)Main.tile[num7, k].type]) + { + int num8 = 0; + int num9 = 15; + for (int l = num7 - num9; l < num7 + num9; l++) + { + for (int m = k - num9; m < k + num9; m++) + { + if (WorldGen.SolidTile(l, m)) + { + num8++; + if (Main.tile[l, m].type == 189 || Main.tile[l, m].type == 202) + { + num8 -= 100; + } + else if (ancientsAwakened != null) + { + if (Main.tile[l, m].type == ancientsAwakened.TileType("InfernoGrass") || Main.tile[l, m].type == ancientsAwakened.TileType("Torchstone") || + Main.tile[l, m].type == ancientsAwakened.TileType("Torchsand") || Main.tile[l, m].type == ancientsAwakened.TileType("Torchsandstone") || + Main.tile[l, m].type == ancientsAwakened.TileType("Torchsandhardened") || Main.tile[l, m].type == ancientsAwakened.TileType("Torchice") || + Main.tile[l, m].type == ancientsAwakened.TileType("Depthstone") || Main.tile[l, m].type == ancientsAwakened.TileType("Depthsand") || + Main.tile[l, m].type == ancientsAwakened.TileType("Depthsandstone") || Main.tile[l, m].type == ancientsAwakened.TileType("Depthsandhardened") || + Main.tile[l, m].type == ancientsAwakened.TileType("Depthice")) + { + num8 -= 100; + } + } + } + else if (Main.tile[l, m].liquid > 0) + { + num8--; + } + } + } + if ((float)num8 < num5) + { + num5 -= 0.5f; + break; + } + flag = astralMeteor(num7, k); + if (flag) + { + break; + } + break; + } + else + { + k++; + } + } + if (num5 < 100f) + { + return; + } + } + } + + public static bool astralMeteor(int i, int j) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + if (i < 50 || i > Main.maxTilesX - 50) + { + return false; + } + if (j < 50 || j > Main.maxTilesY - 50) + { + return false; + } + int num = 35; + Rectangle rectangle = new Rectangle((i - num) * 16, (j - num) * 16, num * 2 * 16, num * 2 * 16); + for (int k = 0; k < 255; k++) + { + if (Main.player[k].active) + { + Rectangle value = new Rectangle((int)(Main.player[k].position.X + (float)(Main.player[k].width / 2) - (float)(NPC.sWidth / 2) - (float)NPC.safeRangeX), (int)(Main.player[k].position.Y + (float)(Main.player[k].height / 2) - (float)(NPC.sHeight / 2) - (float)NPC.safeRangeY), NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2); + if (rectangle.Intersects(value)) + { + return false; + } + } + } + for (int l = 0; l < 200; l++) + { + if (Main.npc[l].active) + { + Rectangle value2 = new Rectangle((int)Main.npc[l].position.X, (int)Main.npc[l].position.Y, Main.npc[l].width, Main.npc[l].height); + if (rectangle.Intersects(value2)) + { + return false; + } + } + } + for (int m = i - num; m < i + num; m++) + { + for (int n = j - num; n < j + num; n++) + { + if (Main.tile[m, n].active() && Main.tile[m, n].type == 21) + { + return false; + } + } + } + num = WorldGen.genRand.Next(17, 23); + for (int num2 = i - num; num2 < i + num; num2++) + { + for (int num3 = j - num; num3 < j + num; num3++) + { + if (num3 > j + Main.rand.Next(-2, 3) - 5) + { + float num4 = (float)Math.Abs(i - num2); + float num5 = (float)Math.Abs(j - num3); + float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); + if ((double)num6 < (double)num * 0.9 + (double)Main.rand.Next(-4, 5)) + { + if (Main.tile[num2, num3] != null) + { + if (!Main.tileSolid[(int)Main.tile[num2, num3].type]) + { + Main.tile[num2, num3].active(false); + } + Main.tile[num2, num3].type = (ushort)mod.TileType("AstralOre"); + } + } + } + } + } + num = WorldGen.genRand.Next(8, 14); + for (int num7 = i - num; num7 < i + num; num7++) + { + for (int num8 = j - num; num8 < j + num; num8++) + { + if (num8 > j + Main.rand.Next(-2, 3) - 4) + { + float num9 = (float)Math.Abs(i - num7); + float num10 = (float)Math.Abs(j - num8); + float num11 = (float)Math.Sqrt((double)(num9 * num9 + num10 * num10)); + if ((double)num11 < (double)num * 0.8 + (double)Main.rand.Next(-3, 4)) + { + if (Main.tile[num7, num8] != null) + Main.tile[num7, num8].active(false); + } + } + } + } + num = WorldGen.genRand.Next(25, 35); + for (int num12 = i - num; num12 < i + num; num12++) + { + for (int num13 = j - num; num13 < j + num; num13++) + { + float num14 = (float)Math.Abs(i - num12); + float num15 = (float)Math.Abs(j - num13); + float num16 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); + if (Main.tile[num12, num13] != null) + { + if ((double)num16 < (double)num * 0.7) + { + if (Main.tile[num12, num13].type == 5 || Main.tile[num12, num13].type == 32 || Main.tile[num12, num13].type == 352) + { + WorldGen.KillTile(num12, num13, false, false, false); + } + Main.tile[num12, num13].liquid = 0; + } + if (Main.tile[num12, num13].type == (ushort)mod.TileType("AstralOre")) + { + if (!WorldGen.SolidTile(num12 - 1, num13) && !WorldGen.SolidTile(num12 + 1, num13) && !WorldGen.SolidTile(num12, num13 - 1) && !WorldGen.SolidTile(num12, num13 + 1)) + { + Main.tile[num12, num13].active(false); + } + else if ((Main.tile[num12, num13].halfBrick() || Main.tile[num12 - 1, num13].topSlope()) && !WorldGen.SolidTile(num12, num13 + 1)) + { + Main.tile[num12, num13].active(false); + } + } + WorldGen.SquareTileFrame(num12, num13, true); + WorldGen.SquareWallFrame(num12, num13, true); + } + } + } + num = WorldGen.genRand.Next(23, 32); + for (int num17 = i - num; num17 < i + num; num17++) + { + for (int num18 = j - num; num18 < j + num; num18++) + { + if (num18 > j + WorldGen.genRand.Next(-3, 4) - 3 && Main.tile[num17, num18].active() && Main.rand.Next(10) == 0) + { + float num19 = (float)Math.Abs(i - num17); + float num20 = (float)Math.Abs(j - num18); + float num21 = (float)Math.Sqrt((double)(num19 * num19 + num20 * num20)); + if ((double)num21 < (double)num * 0.8) + { + if (Main.tile[num17, num18] != null) + { + if (Main.tile[num17, num18].type == 5 || Main.tile[num17, num18].type == 32 || Main.tile[num17, num18].type == 352) + { + WorldGen.KillTile(num17, num18, false, false, false); + } + Main.tile[num17, num18].type = (ushort)mod.TileType("AstralOre"); + WorldGen.SquareTileFrame(num17, num18, true); + } + } + } + } + } + num = WorldGen.genRand.Next(30, 38); + for (int num22 = i - num; num22 < i + num; num22++) + { + for (int num23 = j - num; num23 < j + num; num23++) + { + if (num23 > j + WorldGen.genRand.Next(-2, 3) && Main.tile[num22, num23].active() && Main.rand.Next(20) == 0) + { + float num24 = (float)Math.Abs(i - num22); + float num25 = (float)Math.Abs(j - num23); + float num26 = (float)Math.Sqrt((double)(num24 * num24 + num25 * num25)); + if ((double)num26 < (double)num * 0.85) + { + if (Main.tile[num22, num23] != null) + { + if (Main.tile[num22, num23].type == 5 || Main.tile[num22, num23].type == 32 || Main.tile[num22, num23].type == 352) + { + WorldGen.KillTile(num22, num23, false, false, false); + } + Main.tile[num22, num23].type = (ushort)mod.TileType("AstralOre"); + WorldGen.SquareTileFrame(num22, num23, true); + } + } + } + } + } + if (Main.netMode != 1) + { + NetMessage.SendTileSquare(-1, i, j, 40, TileChangeType.None); + if (checkAstralBiomeSpawn()) + DoAstralConversion(new Point(i, j)); + } + return true; + } + + public static void DoAstralConversion(object obj) + { + //Pre-calculate all variables necessary for elliptical area checking + Point origin = (Point)obj; + Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); + + float angle = MathHelper.Pi * 0.15f; + float otherAngle = MathHelper.PiOver2 - angle; + + int distanceInTiles = 150 + ((Main.maxTilesX - 4200) / 4200) * 200; + float distance = distanceInTiles * 16f; + float constant = (distance * 2f) / (float)Math.Sin(angle); + + float fociSpacing = ((distance * (float)Math.Sin(otherAngle)) / (float)Math.Sin(angle)); + int verticalRadius = (int)(constant / 16f); + + Vector2 fociOffset = Vector2.UnitY * fociSpacing; + Vector2 topFoci = center - fociOffset; + Vector2 bottomFoci = center + fociOffset; + + for (int x = origin.X - distanceInTiles - 2; x <= origin.X + distanceInTiles + 2; x++) + { + for (int y = (int)(origin.Y - verticalRadius * 0.4f) - 3; y <= origin.Y + verticalRadius + 3; y++) + { + float dist; + if (CheckInEllipse(new Point(x, y), topFoci, bottomFoci, constant, center, out dist, y < origin.Y)) + { + //If we're in the outer blurPercent% of the ellipse + float percent = dist / constant; + float blurPercent = 0.98f; + if (percent > blurPercent) + { + float outerEdgePercent = (percent - blurPercent) / (1f - blurPercent); + if (Main.rand.NextFloat(1f) > outerEdgePercent) + { + ConvertToAstral(x, y); + } + } + else + { + ConvertToAstral(x, y); + } + } + } + } + } + + public static void ConvertToAstral(int startX, int endX, int startY, int endY) + { + for (int x = startX; x <= endX; x++) + { + for (int y = startY; y <= endY; y++) + { + ConvertToAstral(x, y); + } + } + } + + public static void ConvertToAstral(int x, int y, bool tileframe = true) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + if (WorldGen.InWorld(x, y, 1)) + { + int type = Main.tile[x, y].type; + int wallType = Main.tile[x, y].wall; + + if (Main.tile[x, y] != null) + { + if (WallID.Sets.Conversion.Grass[wallType]) + { + Main.tile[x, y].wall = (ushort)mod.WallType("AstralGrassWallUnsafe"); + } + else if (WallID.Sets.Conversion.HardenedSand[wallType]) + { + Main.tile[x, y].wall = (ushort)mod.WallType("HardenedAstralSandWallUnsafe"); + } + else if (WallID.Sets.Conversion.Sandstone[wallType]) + { + Main.tile[x, y].wall = (ushort)mod.WallType("AstralSandstoneWallUnsafe"); + } + else if (WallID.Sets.Conversion.Stone[wallType]) + { + Main.tile[x, y].wall = (ushort)mod.WallType("AstralStoneWallUnsafe"); + } + else + { + switch (wallType) + { + case WallID.DirtUnsafe: + case WallID.DirtUnsafe1: + case WallID.DirtUnsafe2: + case WallID.DirtUnsafe3: + case WallID.DirtUnsafe4: + case WallID.Cave6Unsafe: + case WallID.Dirt: + Main.tile[x, y].wall = (ushort)mod.WallType("AstralDirtWallUnsafe"); + break; + case WallID.IceUnsafe: + Main.tile[x, y].wall = (ushort)mod.WallType("AstralIceWallUnsafe"); + break; + } + } + if (TileID.Sets.Conversion.Grass[type] && !TileID.Sets.GrassSpecial[type]) + { + Main.tile[x, y].type = (ushort)mod.TileType("AstralGrass"); + } + else if (TileID.Sets.Conversion.Stone[type] || Main.tileMoss[type]) + { + Main.tile[x, y].type = (ushort)mod.TileType("AstralStone"); + } + else if (TileID.Sets.Conversion.Sand[type]) + { + Main.tile[x, y].type = (ushort)mod.TileType("AstralSand"); + } + else if (TileID.Sets.Conversion.HardenedSand[type]) + { + Main.tile[x, y].type = (ushort)mod.TileType("HardenedAstralSand"); + } + else if (TileID.Sets.Conversion.Sandstone[type]) + { + Main.tile[x, y].type = (ushort)mod.TileType("AstralSandstone"); + } + else if (TileID.Sets.Conversion.Ice[type]) + { + Main.tile[x, y].type = (ushort)mod.TileType("AstralIce"); + } + else + { + Tile tile = Main.tile[x, y]; + switch (type) + { + case TileID.Dirt: + Main.tile[x, y].type = (ushort)mod.TileType("AstralDirt"); + break; + case TileID.Vines: + Main.tile[x, y].type = (ushort)mod.TileType("AstralVines"); + break; + case TileID.LargePiles: + if (tile.frameX <= 1170) + { + RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 0, 1170, 0, 18); + } + if (tile.frameX >= 1728) + { + RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 1728, 1872, 0, 18); + } + if (tile.frameX >= 1404 && tile.frameX <= 1710) + { + RecursiveReplaceToAstral(TileID.LargePiles, (ushort)mod.TileType("AstralIceLargePiles"), x, y, 324, 1404, 1710, 0, 18); + } + break; + case TileID.LargePiles2: + if (tile.frameX >= 1566 && tile.frameY < 36) + { + RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)mod.TileType("AstralDesertLargePiles"), x, y, 324, 1566, 1872, 0, 18); + } + if (tile.frameX >= 756 && tile.frameX <= 900) + { + RecursiveReplaceToAstral(TileID.LargePiles2, (ushort)mod.TileType("AstralNormalLargePiles"), x, y, 324, 756, 900, 0, 18); + } + break; + case TileID.SmallPiles: + if (tile.frameY == 18) + { + ushort newType = 9999; + if (tile.frameX >= 1476 && tile.frameX <= 1674) + { + newType = (ushort)mod.TileType("AstralDesertMediumPiles"); + } + else if (tile.frameX <= 558 || (tile.frameX >= 1368 && tile.frameX <= 1458)) + { + newType = (ushort)mod.TileType("AstralNormalMediumPiles"); + } + else if (tile.frameX >= 900 && tile.frameX <= 1098) + { + newType = (ushort)mod.TileType("AstralIceMediumPiles"); + } + else + { + break; + } + int leftMost = x; + if (tile.frameX % 36 != 0) //this means it's the right tile of the two + { + leftMost--; + } + if (Main.tile[leftMost, y] != null) + Main.tile[leftMost, y].type = newType; + if (Main.tile[leftMost + 1, y] != null) + Main.tile[leftMost + 1, y].type = newType; + while (Main.tile[leftMost, y].frameX >= 216) + { + if (Main.tile[leftMost, y] != null) + Main.tile[leftMost, y].frameX -= 216; + if (Main.tile[leftMost + 1, y] != null) + Main.tile[leftMost + 1, y].frameX -= 216; + } + } + else if (tile.frameY == 0) + { + ushort newType3 = 9999; + if (tile.frameX >= 972 && tile.frameX <= 1062) + { + newType3 = (ushort)mod.TileType("AstralDesertSmallPiles"); + } + else if (tile.frameX <= 486) + { + newType3 = (ushort)mod.TileType("AstralNormalSmallPiles"); + } + else if (tile.frameX >= 648 && tile.frameX <= 846) + { + newType3 = (ushort)mod.TileType("AstralIceSmallPiles"); + } + else + { + break; + } + Main.tile[x, y].type = newType3; + while (Main.tile[x, y].frameX >= 108) //REFRAME IT + { + Main.tile[x, y].frameX -= 108; + } + } + break; + case TileID.Stalactite: + int topMost = tile.frameY <= 54 ? (tile.frameY % 36 == 0 ? y : y - 1) : y; + bool twoTall = tile.frameY <= 54; + bool hanging = tile.frameY <= 18 || tile.frameY == 72; + ushort newType2 = 9999; + if (tile.frameX >= 378 && tile.frameX <= 414) //DESERT + { + newType2 = (ushort)mod.TileType("AstralDesertStalactite"); + } + else if ((tile.frameX >= 54 && tile.frameX <= 90) || (tile.frameX >= 216 && tile.frameX <= 360)) + { + newType2 = (ushort)mod.TileType("AstralNormalStalactite"); + } + else if (tile.frameX <= 36) + { + newType2 = (ushort)mod.TileType("AstralIceStalactite"); + } + else + { + break; + } + + //Set types + if (Main.tile[x, topMost] != null) + Main.tile[x, topMost].type = newType2; + if (twoTall) + { + if (Main.tile[x, topMost + 1] != null) + Main.tile[x, topMost + 1].type = newType2; + } + + //Fix frames + while (Main.tile[x, topMost].frameX >= 54) + { + if (Main.tile[x, topMost] != null) + Main.tile[x, topMost].frameX -= 54; + if (twoTall) + { + if (Main.tile[x, topMost + 1] != null) + Main.tile[x, topMost + 1].frameX -= 54; + } + } + + if (hanging) + { + ConvertToAstral(x, topMost - 1); + break; + } + else + { + if (twoTall) + { + ConvertToAstral(x, topMost + 2); + break; + } + ConvertToAstral(x, topMost + 1); + break; + } + } + } + if (tileframe) + { + if (Main.netMode == 0) + { + WorldGen.SquareTileFrame(x, y, true); + } + else if (Main.netMode == 2) + { + NetMessage.SendTileSquare(-1, x, y, 1); + } + } + } + } + } + + public static void ConvertFromAstral(int x, int y, ConvertType convert) + { + Tile tile = Main.tile[x, y]; + int type = tile.type; + int wallType = tile.wall; + Mod mod = CalamityMod.Instance; + + if (WorldGen.InWorld(x, y, 1)) + { + #region WALL + if (Main.tile[x, y] != null) + { + if (wallType == mod.WallType("AstralDirtWall")) + { + Main.tile[x, y].wall = WallID.DirtUnsafe; + } + else if (wallType == mod.WallType("AstralGrassWall")) + { + switch (convert) + { + case ConvertType.Corrupt: + Main.tile[x, y].wall = WallID.CorruptGrassUnsafe; + break; + case ConvertType.Crimson: + Main.tile[x, y].wall = WallID.CrimsonGrassUnsafe; + break; + case ConvertType.Hallow: + Main.tile[x, y].wall = WallID.HallowedGrassUnsafe; + break; + case ConvertType.Pure: + Main.tile[x, y].wall = WallID.GrassUnsafe; + break; + } + } + else if (wallType == mod.WallType("AstralIceWall")) + { + Main.tile[x, y].wall = WallID.IceUnsafe; + } + else if (wallType == mod.WallType("AstralStoneWall")) + { + switch (convert) + { + case ConvertType.Corrupt: + Main.tile[x, y].wall = WallID.EbonstoneUnsafe; + break; + case ConvertType.Crimson: + Main.tile[x, y].wall = WallID.CrimstoneUnsafe; + break; + case ConvertType.Hallow: + Main.tile[x, y].wall = WallID.PearlstoneBrickUnsafe; + break; + case ConvertType.Pure: + Main.tile[x, y].wall = WallID.Stone; + break; + } + } + } + #endregion + + #region TILE + if (Main.tile[x, y] != null) + { + if (type == mod.TileType("AstralDirt")) + { + tile.type = TileID.Dirt; + } + else if (type == mod.TileType("AstralGrass")) + { + SetTileFromConvert(x, y, convert, TileID.CorruptGrass, TileID.FleshGrass, TileID.HallowedGrass, TileID.Grass); + } + else if (type == mod.TileType("AstralStone")) + { + SetTileFromConvert(x, y, convert, TileID.Ebonstone, TileID.Crimstone, TileID.Pearlstone, TileID.Stone); + } + else if (type == mod.TileType("AstralSand")) + { + SetTileFromConvert(x, y, convert, TileID.Ebonsand, TileID.Crimsand, TileID.Pearlsand, TileID.Sand); + } + else if (type == mod.TileType("AstralSandstone")) + { + SetTileFromConvert(x, y, convert, TileID.CorruptSandstone, TileID.CrimsonSandstone, TileID.HallowSandstone, TileID.Sandstone); + } + else if (type == mod.TileType("HardenedAstralSand")) + { + SetTileFromConvert(x, y, convert, TileID.CorruptHardenedSand, TileID.CrimsonHardenedSand, TileID.HallowHardenedSand, TileID.HardenedSand); + } + else if (type == mod.TileType("AstralIce")) + { + SetTileFromConvert(x, y, convert, TileID.CorruptIce, TileID.FleshIce, TileID.HallowedIce, TileID.IceBlock); + } + else if (type == mod.TileType("AstralVines")) + { + SetTileFromConvert(x, y, convert, ushort.MaxValue, TileID.CrimsonVines, TileID.HallowedVines, TileID.Vines); + } + else if (type == mod.TileType("AstralShortPlants")) + { + SetTileFromConvert(x, y, convert, TileID.CorruptPlants, ushort.MaxValue, TileID.HallowedPlants, TileID.Plants); + } + else if (type == mod.TileType("AstralTallPlants")) + { + SetTileFromConvert(x, y, convert, ushort.MaxValue, ushort.MaxValue, TileID.HallowedPlants2, TileID.Plants2); + } + else if (type == mod.TileType("AstralNormalLargePiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 378, 0); + } + else if (type == mod.TileType("AstralNormalMediumPiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 18); + } + else if (type == mod.TileType("AstralNormalSmallPiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 0, 0); + } + else if (type == mod.TileType("AstralDesertLargePiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles2, x, y, 1566, 0); + } + else if (type == mod.TileType("AstralDesertMediumPiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 1476, 18); + } + else if (type == mod.TileType("AstralDesertSmallPiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 972, 0); + } + else if (type == mod.TileType("AstralIceLargePiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.LargePiles, x, y, 1404, 0); + } + else if (type == mod.TileType("AstralIceMediumPiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 900, 18); + } + else if (type == mod.TileType("AstralIceSmallPiles")) + { + RecursiveReplaceFromAstral((ushort)type, TileID.SmallPiles, x, y, 648, 0); + } + else if (type == mod.TileType("AstralNormalStalactite")) + { + ushort originType = TileID.Stone; + int frameXAdd = 54; + switch (convert) + { + case ConvertType.Corrupt: + originType = TileID.Ebonstone; + frameXAdd = 324; + break; + case ConvertType.Crimson: + originType = TileID.Crimstone; + frameXAdd = 270; + break; + case ConvertType.Hallow: + originType = TileID.Pearlstone; + frameXAdd = 216; + break; + } + ReplaceAstralStalactite((ushort)type, TileID.Stalactite, originType, x, y, frameXAdd, 0); + } + else if (type == mod.TileType("AstralDesertStalactite")) + { + ushort originType = TileID.Sandstone; + int frameXAdd = 378; + switch (convert) + { + case ConvertType.Corrupt: + originType = TileID.CorruptSandstone; + frameXAdd = 324; + break; + case ConvertType.Crimson: + originType = TileID.CrimsonSandstone; + frameXAdd = 270; + break; + case ConvertType.Hallow: + originType = TileID.HallowSandstone; + frameXAdd = 216; + break; + } + ReplaceAstralStalactite((ushort)type, TileID.Stalactite, originType, x, y, frameXAdd, 0); + } + else if (type == mod.TileType("AstralIceStalactite")) + { + ReplaceAstralStalactite((ushort)type, TileID.Stalactite, TileID.IceBlock, x, y, 0, 0); + } + if (TileID.Sets.Conversion.Grass[type] || type == TileID.Dirt) + { + WorldGen.SquareTileFrame(x, y); + } + } + #endregion + } + } + + public static void SetTileFromConvert(int x, int y, ConvertType convert, ushort corrupt, ushort crimson, ushort hallow, ushort pure) + { + switch (convert) + { + case ConvertType.Corrupt: + if (corrupt != ushort.MaxValue) + { + Main.tile[x, y].type = corrupt; + WorldGen.SquareTileFrame(x, y); + } + break; + case ConvertType.Crimson: + if (crimson != ushort.MaxValue) + { + Main.tile[x, y].type = crimson; + WorldGen.SquareTileFrame(x, y); + } + break; + case ConvertType.Hallow: + if (hallow != ushort.MaxValue) + { + Main.tile[x, y].type = hallow; + WorldGen.SquareTileFrame(x, y); + } + break; + case ConvertType.Pure: + if (pure != ushort.MaxValue) + { + Main.tile[x, y].type = pure; + WorldGen.SquareTileFrame(x, y); + } + break; + } + } + + public static void RecursiveReplaceToAstral(ushort checkType, ushort replaceType, int x, int y, int replaceTextureWidth, int minFrameX = 0, int maxFrameX = int.MaxValue, int minFrameY = 0, int maxFrameY = int.MaxValue) + { + Tile tile = Main.tile[x, y]; + if (tile == null || !tile.active() || tile.type != checkType || tile.frameX < minFrameX || tile.frameX > maxFrameX || tile.frameY < minFrameY || tile.frameY > maxFrameY) + return; + + Main.tile[x, y].type = replaceType; + while (Main.tile[x, y].frameX >= replaceTextureWidth) + { + Main.tile[x, y].frameX -= (short)replaceTextureWidth; + } + + if (Main.tile[x - 1, y] != null) + RecursiveReplaceToAstral(checkType, replaceType, x - 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); + if (Main.tile[x + 1, y] != null) + RecursiveReplaceToAstral(checkType, replaceType, x + 1, y, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); + if (Main.tile[x, y - 1] != null) + RecursiveReplaceToAstral(checkType, replaceType, x, y - 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); + if (Main.tile[x, y + 1] != null) + RecursiveReplaceToAstral(checkType, replaceType, x, y + 1, replaceTextureWidth, minFrameX, maxFrameX, minFrameY, maxFrameY); + } + + public static void RecursiveReplaceFromAstral(ushort checkType, ushort replaceType, int x, int y, int addFrameX, int addFrameY) + { + Tile tile = Main.tile[x, y]; + if (tile == null || !tile.active() || tile.type != checkType) + return; + + Main.tile[x, y].type = replaceType; + Main.tile[x, y].frameX += (short)addFrameX; + Main.tile[x, y].frameY += (short)addFrameY; + + if (Main.tile[x - 1, y] != null) + RecursiveReplaceFromAstral(checkType, replaceType, x - 1, y, addFrameX, addFrameY); + if (Main.tile[x + 1, y] != null) + RecursiveReplaceFromAstral(checkType, replaceType, x + 1, y, addFrameX, addFrameY); + if (Main.tile[x, y - 1] != null) + RecursiveReplaceFromAstral(checkType, replaceType, x, y - 1, addFrameX, addFrameY); + if (Main.tile[x, y + 1] != null) + RecursiveReplaceFromAstral(checkType, replaceType, x, y + 1, addFrameX, addFrameY); + } + + public static void ReplaceAstralStalactite(ushort checkType, ushort replaceType, ushort replaceOriginTile, int x, int y, int addFrameX, int addFrameY) + { + Tile tile = Main.tile[x, y]; + + int topMost = tile.frameY <= 54 ? (tile.frameY % 36 == 0 ? y : y - 1) : y; + bool twoTall = tile.frameY <= 54; + bool hanging = tile.frameY <= 18 || tile.frameY == 72; + + int yOriginTile = (hanging ? topMost - 1 : (twoTall ? topMost + 2 : y + 1)); + + if (Main.tile[x, topMost++] != null) + Main.tile[x, topMost++].type = replaceType; + if (twoTall) + { + if (Main.tile[x, topMost] != null) + Main.tile[x, topMost].type = replaceType; + } + if (Main.tile[x, yOriginTile] != null) + Main.tile[x, yOriginTile].type = replaceOriginTile; + } + + public static bool CheckInEllipse(Point tile, Vector2 focus1, Vector2 focus2, float distanceConstant, Vector2 center, out float distance, bool collapse = false) + { + Vector2 point = tile.ToVector2() * 16f + new Vector2(8f); + if (collapse) //Collapse ensures the ellipse is shrunk down a lot in terms of distance. + { + float distY = center.Y - point.Y; + point.Y -= distY * 8f; + } + float distance1 = Vector2.Distance(point, focus1); + float distance2 = Vector2.Distance(point, focus2); + distance = distance1 + distance2; + return distance <= distanceConstant; + } + #endregion + + #region EvilIsland + public static void EvilIsland(int i, int j) + { + double num = (double)WorldGen.genRand.Next(100, 150); //100 150 + float num2 = (float)WorldGen.genRand.Next(20, 30); //20 30 + int num3 = i; + int num4 = i; + int num5 = i; + int num6 = j; + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = (int)((double)vector.Y - num * 0.5); + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < 0) + { + num9 = 0; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; //80 120 + float num12 = vector.Y + 1f; + for (int k = num7; k < num8; k++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num12 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num12 < vector.Y) + { + num12 = vector.Y; + } + if (num12 > vector.Y + 2f) + { + num12 = vector.Y + 2f; + } + for (int l = num9; l < num10; l++) + { + if ((float)l > num12) + { + float arg_218_0 = Math.Abs((float)k - vector.X); + float num13 = Math.Abs((float)l - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) + { + if (k < num3) + { + num3 = k; + } + if (k > num4) + { + num4 = k; + } + if (l < num5) + { + num5 = l; + } + if (l > num6) + { + num6 = l; + } + Main.tile[k, l].active(true); + Main.tile[k, l].type = (ushort)(WorldGen.crimson ? 400 : 401); //ebonstone or crimstone + WorldGen.SquareTileFrame(k, l, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int m = num3; + int num15; + for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) + { + int num14 = num6; + while (!Main.tile[m, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); + num15 = WorldGen.genRand.Next(4, 8); + int num16 = (WorldGen.crimson ? 400 : 401); + if (WorldGen.genRand.Next(4) == 0) + { + num16 = (WorldGen.crimson ? 398 : 399); + } + for (int n = m - num15; n <= m + num15; n++) + { + for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - m); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) + { + Main.tile[n, num17].active(true); + Main.tile[n, num17].type = (ushort)num16; + WorldGen.SquareTileFrame(n, num17, true); + } + } + } + } + } + num = (double)WorldGen.genRand.Next(80, 95); + num2 = (float)WorldGen.genRand.Next(10, 15); + vector.X = (float)i; + vector.Y = (float)num5; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = num5 - 1; + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < 0) + { + num9 = 0; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(80, 120) * 0.01; + float num19 = vector.Y + 1f; + for (int num20 = num7; num20 < num8; num20++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num19 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num19 < vector.Y) + { + num19 = vector.Y; + } + if (num19 > vector.Y + 2f) + { + num19 = vector.Y + 2f; + } + for (int num21 = num9; num21 < num10; num21++) + { + if ((float)num21 > num19) + { + float arg_69E_0 = Math.Abs((float)num20 - vector.X); + float num22 = Math.Abs((float)num21 - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_69E_0 * arg_69E_0 + num22 * num22)) < num11 * 0.4 && + Main.tile[num20, num21].type == (WorldGen.crimson ? 400 : 401)) + { + Main.tile[num20, num21].type = (ushort)(WorldGen.crimson ? 22 : 204); //ore + WorldGen.SquareTileFrame(num20, num21, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int num23 = num3; + num23 += WorldGen.genRand.Next(5); + while (num23 < num4) + { + int num24 = num6; + while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) + { + num24--; + if (num24 < num5) + { + num24 = num6; + num23 += WorldGen.genRand.Next(1, 4); + } + } + if (num23 < num4) + { + num24 += WorldGen.genRand.Next(0, 4); + int num25 = WorldGen.genRand.Next(2, 5); + int num26 = (WorldGen.crimson ? 400 : 401); + for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) + { + for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) + { + if (num28 > num5) + { + float arg_890_0 = (float)Math.Abs(num27 - num23); + float num29 = (float)(Math.Abs(num28 - num24) * 2); + if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) + { + Main.tile[num27, num28].type = (ushort)num26; + WorldGen.SquareTileFrame(num27, num28, true); + } + } + } + } + num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); + } + } + for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) + { + for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) + { + bool flag = true; + for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) + { + for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) + { + if (!Main.tile[num32, num33].active()) + { + flag = false; + } + } + } + if (flag) + { + Main.tile[num30, num31].wall = (ushort)(WorldGen.crimson ? 220 : 221); + WorldGen.SquareWallFrame(num30, num31, true); + } + } + } + for (int num34 = num3; num34 <= num4; num34++) + { + int num35 = num5 - 10; + while (!Main.tile[num34, num35 + 1].active()) + { + num35++; + } + if (num35 < num6 && Main.tile[num34, num35 + 1].type == (WorldGen.crimson ? 400 : 401)) + { + if (WorldGen.genRand.Next(10) == 0) + { + int num36 = WorldGen.genRand.Next(1, 3); + for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) + { + if (Main.tile[num37, num35].type == (WorldGen.crimson ? 400 : 401)) + { + Main.tile[num37, num35].active(false); + Main.tile[num37, num35].liquid = 255; + Main.tile[num37, num35].lava(false); + WorldGen.SquareTileFrame(num34, num35, true); + } + if (Main.tile[num37, num35 + 1].type == (WorldGen.crimson ? 400 : 401)) + { + Main.tile[num37, num35 + 1].active(false); + Main.tile[num37, num35 + 1].liquid = 255; + Main.tile[num37, num35 + 1].lava(false); + WorldGen.SquareTileFrame(num34, num35 + 1, true); + } + if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (WorldGen.crimson ? 400 : 401)) + { + Main.tile[num37, num35 + 2].active(false); + Main.tile[num37, num35 + 2].liquid = 255; + Main.tile[num37, num35 + 2].lava(false); + WorldGen.SquareTileFrame(num34, num35 + 2, true); + } + } + } + if (WorldGen.genRand.Next(5) == 0) + { + Main.tile[num34, num35].liquid = 255; + } + Main.tile[num34, num35].lava(false); + WorldGen.SquareTileFrame(num34, num35, true); + } + } + int num38 = WorldGen.genRand.Next(4); + for (int num39 = 0; num39 <= num38; num39++) + { + int num40 = WorldGen.genRand.Next(num3 - 5, num4 + 5); + int num41 = num5 - WorldGen.genRand.Next(20, 40); + int num42 = WorldGen.genRand.Next(4, 8); + int num43 = (WorldGen.crimson ? 400 : 401); + if (WorldGen.genRand.Next(2) == 0) + { + num43 = (WorldGen.crimson ? 398 : 399); + } + for (int num44 = num40 - num42; num44 <= num40 + num42; num44++) + { + for (int num45 = num41 - num42; num45 <= num41 + num42; num45++) + { + float arg_C74_0 = (float)Math.Abs(num44 - num40); + float num46 = (float)(Math.Abs(num45 - num41) * 2); + if (Math.Sqrt((double)(arg_C74_0 * arg_C74_0 + num46 * num46)) < (double)(num42 + WorldGen.genRand.Next(-1, 2))) + { + Main.tile[num44, num45].active(true); + Main.tile[num44, num45].type = (ushort)num43; + WorldGen.SquareTileFrame(num44, num45, true); + } + } + } + for (int num47 = num40 - num42 + 2; num47 <= num40 + num42 - 2; num47++) + { + int num48 = num41 - num42; + while (!Main.tile[num47, num48].active()) + { + num48++; + } + Main.tile[num47, num48].active(false); + Main.tile[num47, num48].liquid = 255; + WorldGen.SquareTileFrame(num47, num48, true); + } + } + } + #endregion + + #region EvilIslandHouse + public static void EvilIslandHouse(int i, int j) + { + ushort type = (ushort)(WorldGen.crimson ? 152 : 347); //tile + byte wall = (byte)(WorldGen.crimson ? 35 : 174); //wall + Vector2 vector = new Vector2((float)i, (float)j); + int num = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num = -1; + } + int num2 = WorldGen.genRand.Next(7, 12); + int num3 = WorldGen.genRand.Next(5, 7); + vector.X = (float)(i + (num2 + 2) * num); + for (int k = j - 15; k < j + 30; k++) + { + if (Main.tile[(int)vector.X, k].active()) + { + vector.Y = (float)(k - 1); + break; + } + } + vector.X = (float)i; + int num4 = (int)(vector.X - (float)num2 - 1f); + int num5 = (int)(vector.X + (float)num2 + 1f); + int num6 = (int)(vector.Y - (float)num3 - 1f); + int num7 = (int)(vector.Y + 2f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int l = num4; l <= num5; l++) + { + for (int m = num6 - 1; m < num7 + 1; m++) + { + if (m != num6 - 1 || (l != num4 && l != num5)) + { + Main.tile[l, m].active(true); + Main.tile[l, m].liquid = 0; + Main.tile[l, m].type = type; + Main.tile[l, m].wall = 0; + Main.tile[l, m].halfBrick(false); + Main.tile[l, m].slope(0); + } + } + } + num4 = (int)(vector.X - (float)num2); + num5 = (int)(vector.X + (float)num2); + num6 = (int)(vector.Y - (float)num3); + num7 = (int)(vector.Y + 1f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int n = num4; n <= num5; n++) + { + for (int num8 = num6; num8 < num7; num8++) + { + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) + { + Main.tile[n, num8].active(false); + Main.tile[n, num8].wall = wall; + } + } + } + int num9 = i + (num2 + 1) * num; + int num10 = (int)vector.Y; + for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) + { + Main.tile[num11, num10].active(false); + Main.tile[num11, num10 - 1].active(false); + Main.tile[num11, num10 - 2].active(false); + } + WorldGen.PlaceTile(num9, num10, 10, true, false, -1, (WorldGen.crimson ? 1 : 10)); //door + num9 = i + (num2 + 1) * -num - num; + for (int num12 = num6; num12 <= num7 + 1; num12++) + { + Main.tile[num9, num12].active(true); + Main.tile[num9, num12].liquid = 0; + Main.tile[num9, num12].type = type; + Main.tile[num9, num12].wall = 0; + Main.tile[num9, num12].halfBrick(false); + Main.tile[num9, num12].slope(0); + } + int contain = 0; + if (WorldGen.crimson) + { + contain = 1571; //scourge + } + else + { + contain = 1569; //vampire + } + WorldGen.AddBuriedChest(i, num10 - 3, contain, false, (WorldGen.crimson ? 19 : 20)); //chest + int num14 = i - num2 / 2 + 1; + int num15 = i + num2 / 2 - 1; + int num16 = 1; + if (num2 > 10) + { + num16 = 2; + } + int num17 = (num6 + num7) / 2 - 1; + for (int num18 = num14 - num16; num18 <= num14 + num16; num18++) + { + for (int num19 = num17 - 1; num19 <= num17 + 1; num19++) + { + Main.tile[num18, num19].wall = 21; //glass + } + } + for (int num20 = num15 - num16; num20 <= num15 + num16; num20++) + { + for (int num21 = num17 - 1; num21 <= num17 + 1; num21++) + { + Main.tile[num20, num21].wall = 21; //glass + } + } + int num22 = i + (num2 / 2 + 1) * -num; + WorldGen.PlaceTile(num22, num7 - 1, 14, true, false, -1, (WorldGen.crimson ? 1 : 8)); //table + WorldGen.PlaceTile(num22 - 2, num7 - 1, 15, true, false, 0, (WorldGen.crimson ? 2 : 11)); //chair + Tile expr_510 = Main.tile[num22 - 2, num7 - 1]; + expr_510.frameX += 18; + Tile expr_531 = Main.tile[num22 - 2, num7 - 2]; + expr_531.frameX += 18; + WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, (WorldGen.crimson ? 2 : 11)); //chair + } + #endregion + + #region UnderworldIsland + public static void UnderworldIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 + float num2 = (float)WorldGen.genRand.Next(sizeMin / 5, sizeMax / 5); //20 30 + int num3 = i; + int num4 = i; + int num5 = i; + int num6 = j; + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = (int)((double)vector.Y - num * 0.5); + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < 0) + { + num9 = 0; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 + float num12 = vector.Y + 1f; + for (int k = num7; k < num8; k++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num12 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num12 < vector.Y) + { + num12 = vector.Y; + } + if (num12 > vector.Y + 2f) + { + num12 = vector.Y + 2f; + } + for (int l = num9; l < num10; l++) + { + if ((float)l > num12) + { + float arg_218_0 = Math.Abs((float)k - vector.X); + float num13 = Math.Abs((float)l - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) + { + if (k < num3) + { + num3 = k; + } + if (k > num4) + { + num4 = k; + } + if (l < num5) + { + num5 = l; + } + if (l > num6) + { + num6 = l; + } + Main.tile[k, l].active(true); + Main.tile[k, l].type = (ushort)mod.TileType("BrimstoneSlag"); + WorldGen.SquareTileFrame(k, l, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int m = num3; + int num15; + for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) + { + int num14 = num6; + while (!Main.tile[m, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); + num15 = WorldGen.genRand.Next(4, 8); + int num16 = mod.TileType("BrimstoneSlag"); + if (WorldGen.genRand.Next(4) == 0) + { + num16 = mod.TileType("CharredOre"); + } + for (int n = m - num15; n <= m + num15; n++) + { + for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - m); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) + { + Main.tile[n, num17].active(true); + Main.tile[n, num17].type = (ushort)num16; + WorldGen.SquareTileFrame(n, num17, true); + } + } + } + } + } + num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); + num2 = (float)WorldGen.genRand.Next(sizeMin2 / 8, sizeMax2 / 8); + vector.X = (float)i; + vector.Y = (float)num5; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int num23 = num3; + num23 += WorldGen.genRand.Next(5); + while (num23 < num4) + { + int num24 = num6; + while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) + { + num24--; + if (num24 < num5) + { + num24 = num6; + num23 += WorldGen.genRand.Next(1, 4); + } + } + if (num23 < num4) + { + num24 += WorldGen.genRand.Next(0, 4); + int num25 = WorldGen.genRand.Next(2, 5); + int num26 = mod.TileType("BrimstoneSlag"); + for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) + { + for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) + { + if (num28 > num5) + { + float arg_890_0 = (float)Math.Abs(num27 - num23); + float num29 = (float)(Math.Abs(num28 - num24) * 2); + if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) + { + Main.tile[num27, num28].type = (ushort)num26; + WorldGen.SquareTileFrame(num27, num28, true); + } + } + } + } + num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); + } + } + for (int num34 = num3; num34 <= num4; num34++) + { + int num35 = num5 - 10; + while (!Main.tile[num34, num35 + 1].active()) + { + num35++; + } + if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)mod.TileType("BrimstoneSlag")) + { + if (WorldGen.genRand.Next(10) == 0) + { + int num36 = WorldGen.genRand.Next(1, 3); + for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) + { + if (Main.tile[num37, num35].type == (ushort)mod.TileType("BrimstoneSlag")) + { + Main.tile[num37, num35].active(false); + Main.tile[num37, num35].liquid = 255; + Main.tile[num37, num35].lava(false); + WorldGen.SquareTileFrame(num34, num35, true); + } + if (Main.tile[num37, num35 + 1].type == (ushort)mod.TileType("BrimstoneSlag")) + { + Main.tile[num37, num35 + 1].active(false); + Main.tile[num37, num35 + 1].liquid = 255; + Main.tile[num37, num35 + 1].lava(false); + WorldGen.SquareTileFrame(num34, num35 + 1, true); + } + if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)mod.TileType("BrimstoneSlag")) + { + Main.tile[num37, num35 + 2].active(false); + Main.tile[num37, num35 + 2].liquid = 255; + Main.tile[num37, num35 + 2].lava(false); + WorldGen.SquareTileFrame(num34, num35 + 2, true); + } + } + } + if (WorldGen.genRand.Next(5) == 0) + { + Main.tile[num34, num35].liquid = 255; + } + Main.tile[num34, num35].lava(false); + WorldGen.SquareTileFrame(num34, num35, true); + } + } + } + #endregion + + #region UnderworldIslandHouse + public static void UnderworldIslandHouse(int i, int j, int item) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + ushort type = (ushort)mod.TileType("BrimstoneSlag"); //tile + byte wall = (byte)14; //wall + Vector2 vector = new Vector2((float)i, (float)j); + int num = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num = -1; + } + int num2 = WorldGen.genRand.Next(7, 12); + int num3 = WorldGen.genRand.Next(5, 7); + vector.X = (float)(i + (num2 + 2) * num); + for (int k = j - 15; k < j + 30; k++) + { + if (Main.tile[(int)vector.X, k].active()) + { + vector.Y = (float)(k - 1); + break; + } + } + vector.X = (float)i; + int num4 = (int)(vector.X - (float)num2 - 1f); + int num5 = (int)(vector.X + (float)num2 + 1f); + int num6 = (int)(vector.Y - (float)num3 - 1f); + int num7 = (int)(vector.Y + 2f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int l = num4; l <= num5; l++) + { + for (int m = num6 - 1; m < num7 + 1; m++) + { + if (m != num6 - 1 || (l != num4 && l != num5)) + { + Main.tile[l, m].active(true); + Main.tile[l, m].liquid = 0; + Main.tile[l, m].type = type; + Main.tile[l, m].wall = 0; + Main.tile[l, m].halfBrick(false); + Main.tile[l, m].slope(0); + } + } + } + num4 = (int)(vector.X - (float)num2); + num5 = (int)(vector.X + (float)num2); + num6 = (int)(vector.Y - (float)num3); + num7 = (int)(vector.Y + 1f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int n = num4; n <= num5; n++) + { + for (int num8 = num6; num8 < num7; num8++) + { + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == 0) + { + Main.tile[n, num8].active(false); + Main.tile[n, num8].wall = wall; + } + } + } + int num9 = i + (num2 + 1) * num; + int num10 = (int)vector.Y; + for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) + { + Main.tile[num11, num10].active(false); + Main.tile[num11, num10 - 1].active(false); + Main.tile[num11, num10 - 2].active(false); + } + WorldGen.PlaceTile(num9, num10, 10, true, false, -1, 19); //door + num9 = i + (num2 + 1) * -num - num; + for (int num12 = num6; num12 <= num7 + 1; num12++) + { + Main.tile[num9, num12].active(true); + Main.tile[num9, num12].liquid = 0; + Main.tile[num9, num12].type = type; + Main.tile[num9, num12].wall = 0; + Main.tile[num9, num12].halfBrick(false); + Main.tile[num9, num12].slope(0); + } + WorldGen.AddBuriedChest(i, num10 - 3, item, false, 4); //chest + int num22 = i + (num2 / 2 + 1) * -num; + WorldGen.PlaceTile(num22, num7 - 1, 14, true, false, -1, 13); //table + WorldGen.PlaceTile(num22 - 2, num7 - 1, 15, true, false, 0, 16); //chair + Tile expr_510 = Main.tile[num22 - 2, num7 - 1]; + expr_510.frameX += 18; + Tile expr_531 = Main.tile[num22 - 2, num7 - 2]; + expr_531.frameX += 18; + WorldGen.PlaceTile(num22 + 2, num7 - 1, 15, true, false, 0, 16); //chair + } + #endregion + + #region AbyssIsland + public static void AbyssIsland(int i, int j, int sizeMin, int sizeMax, int sizeMin2, int sizeMax2, bool hasChest, bool hasTenebris, bool isVoid) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int sizeMinSmall = sizeMin / 5; + int sizeMaxSmall = sizeMax / 5; + double num = (double)WorldGen.genRand.Next(sizeMin, sizeMax); //100 150 + float num2 = (float)WorldGen.genRand.Next(sizeMinSmall, sizeMaxSmall); //20 30 + int num3 = i; + int num4 = i; + int num5 = i; + int num6 = j; + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + int num7 = (int)((double)vector.X - num * 0.5); + int num8 = (int)((double)vector.X + num * 0.5); + int num9 = (int)((double)vector.Y - num * 0.5); + int num10 = (int)((double)vector.Y + num * 0.5); + if (num7 < 0) + { + num7 = 0; + } + if (num8 > Main.maxTilesX) + { + num8 = Main.maxTilesX; + } + if (num9 < 0) + { + num9 = 0; + } + if (num10 > Main.maxTilesY) + { + num10 = Main.maxTilesY; + } + double num11 = num * (double)WorldGen.genRand.Next(sizeMin, sizeMax) * 0.01; //80 120 + float num12 = vector.Y + 1f; + for (int k = num7; k < num8; k++) + { + if (WorldGen.genRand.Next(2) == 0) + { + num12 += (float)WorldGen.genRand.Next(-1, 2); + } + if (num12 < vector.Y) + { + num12 = vector.Y; + } + if (num12 > vector.Y + 2f) + { + num12 = vector.Y + 2f; + } + for (int l = num9; l < num10; l++) + { + if ((float)l > num12) + { + float arg_218_0 = Math.Abs((float)k - vector.X); + float num13 = Math.Abs((float)l - vector.Y) * 3f; + if (Math.Sqrt((double)(arg_218_0 * arg_218_0 + num13 * num13)) < num11 * 0.4) + { + if (k < num3) + { + num3 = k; + } + if (k > num4) + { + num4 = k; + } + if (l < num5) + { + num5 = l; + } + if (l > num6) + { + num6 = l; + } + Main.tile[k, l].active(true); + Main.tile[k, l].type = (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); + SafeSquareTileFrame(k, l, true); + } + } + } + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int m = num3; + int num15; + for (m += WorldGen.genRand.Next(5); m < num4; m += WorldGen.genRand.Next(num15, (int)((double)num15 * 1.5))) + { + int num14 = num6; + while (!Main.tile[m, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); + num15 = WorldGen.genRand.Next(4, 8); + int num16 = (isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); + if (WorldGen.genRand.Next(4) == 0) + { + num16 = (hasChest ? mod.TileType("ChaoticOre") : mod.TileType("PlantyMush")); + } + for (int n = m - num15; n <= m + num15; n++) + { + for (int num17 = num14 - num15; num17 <= num14 + num15; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - m); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num15 + WorldGen.genRand.Next(2))) + { + Main.tile[n, num17].active(true); + Main.tile[n, num17].type = (ushort)num16; + SafeSquareTileFrame(n, num17, true); + } + } + } + } + } + if (hasTenebris) + { + int p = num3; + int num150; + for (p += WorldGen.genRand.Next(5); p < num4; p += WorldGen.genRand.Next(num150, (int)((double)num150 * 1.5))) + { + int num14 = num6; + while (!Main.tile[p, num14].active()) + { + num14--; + } + num14 += WorldGen.genRand.Next(-3, 4); //-3 4 + num150 = 1; //4 8 + int num16 = mod.TileType("Tenebris"); + for (int n = p - num150; n <= p + num150; n++) + { + for (int num17 = num14 - num150; num17 <= num14 + num150; num17++) + { + if (num17 > num5) + { + float arg_409_0 = (float)Math.Abs(n - p); + float num18 = (float)(Math.Abs(num17 - num14) * 2); + if (Math.Sqrt((double)(arg_409_0 * arg_409_0 + num18 * num18)) < (double)(num150 + WorldGen.genRand.Next(2))) + { + Main.tile[n, num17].active(true); + Main.tile[n, num17].type = (ushort)num16; + SafeSquareTileFrame(n, num17, true); + } + } + } + } + } + } + int sizeMinSmall2 = sizeMin2 / 8; + int sizeMaxSmall2 = sizeMax2 / 8; + num = (double)WorldGen.genRand.Next(sizeMin2, sizeMax2); + num2 = (float)WorldGen.genRand.Next(sizeMinSmall2, sizeMaxSmall2); + vector.X = (float)i; + vector.Y = (float)num5; + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + while (vector2.X > -2f && vector2.X < 2f) + { + vector2.X = (float)WorldGen.genRand.Next(-20, 21) * 0.2f; + } + vector2.Y = (float)WorldGen.genRand.Next(-20, -10) * 0.02f; + while (num > 0.0 && num2 > 0f) + { + num -= (double)WorldGen.genRand.Next(4); + num2 -= 1f; + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-20, 21) * 0.05f; + if (vector2.X > 1f) + { + vector2.X = 1f; + } + if (vector2.X < -1f) + { + vector2.X = -1f; + } + if ((double)vector2.Y > 0.2) + { + vector2.Y = -0.2f; + } + if ((double)vector2.Y < -0.2) + { + vector2.Y = -0.2f; + } + } + int num23 = num3; + num23 += WorldGen.genRand.Next(5); + while (num23 < num4) + { + int num24 = num6; + while ((!Main.tile[num23, num24].active() || Main.tile[num23, num24].type != 0) && num23 < num4) + { + num24--; + if (num24 < num5) + { + num24 = num6; + num23 += WorldGen.genRand.Next(1, 4); + } + } + if (num23 < num4) + { + num24 += WorldGen.genRand.Next(0, 4); + int num25 = WorldGen.genRand.Next(2, 5); + int num26 = (isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); + for (int num27 = num23 - num25; num27 <= num23 + num25; num27++) + { + for (int num28 = num24 - num25; num28 <= num24 + num25; num28++) + { + if (num28 > num5) + { + float arg_890_0 = (float)Math.Abs(num27 - num23); + float num29 = (float)(Math.Abs(num28 - num24) * 2); + if (Math.Sqrt((double)(arg_890_0 * arg_890_0 + num29 * num29)) < (double)num25) + { + Main.tile[num27, num28].type = (ushort)num26; + SafeSquareTileFrame(num27, num28, true); + } + } + } + } + num23 += WorldGen.genRand.Next(num25, (int)((double)num25 * 1.5)); + } + } + for (int num30 = num3 - 20; num30 <= num4 + 20; num30++) + { + for (int num31 = num5 - 20; num31 <= num6 + 20; num31++) + { + bool flag = true; + for (int num32 = num30 - 1; num32 <= num30 + 1; num32++) + { + for (int num33 = num31 - 1; num33 <= num31 + 1; num33++) + { + if (!Main.tile[num32, num33].active()) + { + flag = false; + } + } + } + if (flag) + { + Main.tile[num30, num31].wall = (ushort)(isVoid ? mod.WallType("VoidstoneWallUnsafe") : mod.WallType("AbyssGravelWall")); + WorldGen.SquareWallFrame(num30, num31, true); + } + } + } + for (int num34 = num3; num34 <= num4; num34++) + { + int num35 = num5 - 10; + while (!Main.tile[num34, num35 + 1].active()) + { + num35++; + } + if (num35 < num6 && Main.tile[num34, num35 + 1].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) + { + if (WorldGen.genRand.Next(10) == 0) + { + int num36 = WorldGen.genRand.Next(1, 3); + for (int num37 = num34 - num36; num37 <= num34 + num36; num37++) + { + if (Main.tile[num37, num35].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) + { + Main.tile[num37, num35].active(false); + Main.tile[num37, num35].liquid = 255; + Main.tile[num37, num35].lava(false); + SafeSquareTileFrame(num34, num35, true); + } + if (Main.tile[num37, num35 + 1].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) + { + Main.tile[num37, num35 + 1].active(false); + Main.tile[num37, num35 + 1].liquid = 255; + Main.tile[num37, num35 + 1].lava(false); + SafeSquareTileFrame(num34, num35 + 1, true); + } + if (num37 > num34 - num36 && num37 < num34 + 2 && Main.tile[num37, num35 + 2].type == (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel"))) + { + Main.tile[num37, num35 + 2].active(false); + Main.tile[num37, num35 + 2].liquid = 255; + Main.tile[num37, num35 + 2].lava(false); + SafeSquareTileFrame(num34, num35 + 2, true); + } + } + } + if (WorldGen.genRand.Next(5) == 0) + { + Main.tile[num34, num35].liquid = 255; + } + Main.tile[num34, num35].lava(false); + SafeSquareTileFrame(num34, num35, true); + } + } + } + #endregion + + #region AbyssIslandHouse + public static void AbyssIslandHouse(int i, int j, int itemChoice, bool isVoid) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + ushort type = (ushort)(isVoid ? mod.TileType("Voidstone") : mod.TileType("AbyssGravel")); //tile + ushort wall = (ushort)(isVoid ? mod.WallType("VoidstoneWallUnsafe") : mod.WallType("AbyssGravelWall")); //wall + Vector2 vector = new Vector2((float)i, (float)j); + int num = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num = -1; + } + int num2 = WorldGen.genRand.Next(5, 9); + int num3 = 3; + vector.X = (float)(i + (num2 + 2) * num); + for (int k = j - 15; k < j + 30; k++) + { + if (Main.tile[(int)vector.X, k].active()) + { + vector.Y = (float)(k - 1); + break; + } + } + vector.X = (float)i; + int num4 = (int)(vector.X - (float)num2 - 1f); + int num5 = (int)(vector.X + (float)num2 + 1f); + int num6 = (int)(vector.Y - (float)num3 - 1f); + int num7 = (int)(vector.Y + 2f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int l = num4; l <= num5; l++) + { + for (int m = num6 - 1; m < num7 + 1; m++) + { + if (m != num6 - 1 || (l != num4 && l != num5)) + { + Main.tile[l, m].active(true); + Main.tile[l, m].type = type; + Main.tile[l, m].wall = wall; + Main.tile[l, m].halfBrick(false); + Main.tile[l, m].slope(0); + } + } + } + num4 = (int)(vector.X - (float)num2); + num5 = (int)(vector.X + (float)num2); + num6 = (int)(vector.Y - (float)num3); + num7 = (int)(vector.Y + 1f); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX) + { + num5 = Main.maxTilesX; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int n = num4; n <= num5; n++) + { + for (int num8 = num6; num8 < num7; num8++) + { + if ((num8 != num6 || (n != num4 && n != num5)) && Main.tile[n, num8].wall == wall) + { + Main.tile[n, num8].active(false); + } + } + } + int num9 = i + (num2 + 1) * num; + int num10 = (int)vector.Y; + for (int num11 = num9 - 2; num11 <= num9 + 2; num11++) + { + Main.tile[num11, num10].active(false); + Main.tile[num11, num10 - 1].active(false); + Main.tile[num11, num10 - 2].active(false); + } + switch (itemChoice) + { + case 0: itemChoice = mod.ItemType("TorrentialTear"); break; //rain item + case 1: itemChoice = mod.ItemType("IronBoots"); break; //movement acc + case 2: itemChoice = mod.ItemType("DepthCharm"); break; //regen acc + case 3: itemChoice = mod.ItemType("Archerfish"); break; //ranged + case 4: itemChoice = mod.ItemType("AnechoicPlating"); break; //defense acc + case 5: itemChoice = mod.ItemType("BallOFugu"); break; //melee + case 6: itemChoice = mod.ItemType("StrangeOrb"); break; //light pet + case 7: itemChoice = mod.ItemType("HerringStaff"); break; //summon + case 8: itemChoice = mod.ItemType("BlackAnurian"); break; //magic + case 9: itemChoice = mod.ItemType("Lionfish"); break; //throwing + default: itemChoice = 497; break; + } + WorldGen.AddBuriedChest(i, num10 - 3, itemChoice, false, 4); //chest + } + #endregion + + #region IcePyramid + public static bool IcePyramid(int i, int j) + { + ushort num = 161; + int arg_36_0 = j - WorldGen.genRand.Next(0, 7); + int num2 = WorldGen.genRand.Next(9, 13); + int num3 = 1; + int num4 = j + WorldGen.genRand.Next(75, 125); //75 125 + for (int k = arg_36_0; k < num4; k++) + { + for (int l = i - num3; l < i + num3 - 1; l++) + { + Main.tile[l, k].type = num; + Main.tile[l, k].active(true); + Main.tile[l, k].halfBrick(false); + Main.tile[l, k].slope(0); + } + num3++; + } + for (int m = i - num3 - 5; m <= i + num3 + 5; m++) + { + for (int n = j - 1; n <= num4 + 1; n++) + { + bool flag = true; + for (int num5 = m - 1; num5 <= m + 1; num5++) + { + for (int num6 = n - 1; num6 <= n + 1; num6++) + { + if (Main.tile[num5, num6].type != num) + { + flag = false; + } + } + } + if (flag) + { + Main.tile[m, n].wall = 71; + WorldGen.SquareWallFrame(m, n, true); + } + } + } + int num7 = 1; + if (WorldGen.genRand.Next(2) == 0) + { + num7 = -1; + } + int num8 = i - num2 * num7; + int num9 = j + num2; + int num10 = WorldGen.genRand.Next(5, 8); + bool flag2 = true; + int num11 = WorldGen.genRand.Next(20, 30); + while (flag2) + { + flag2 = false; + bool flag3 = false; + for (int num12 = num9; num12 <= num9 + num10; num12++) + { + int num13 = num8; + if (Main.tile[num13, num12 - 1].type == 161) + { + flag3 = true; + } + if (Main.tile[num13, num12].type == num) + { + Main.tile[num13, num12 + 1].wall = 71; + Main.tile[num13 + num7, num12].wall = 71; + Main.tile[num13, num12].active(false); + flag2 = true; + } + if (flag3) + { + Main.tile[num13, num12].type = 161; + Main.tile[num13, num12].active(true); + Main.tile[num13, num12].halfBrick(false); + Main.tile[num13, num12].slope(0); + } + } + num8 -= num7; + } + num8 = i - num2 * num7; + bool flag4 = true; + bool flag5 = false; + flag2 = true; + while (flag2) + { + for (int num14 = num9; num14 <= num9 + num10; num14++) + { + int num15 = num8; + Main.tile[num15, num14].active(false); + } + num8 += num7; + num9++; + num11--; + if (num9 >= num4 - num10 * 2) + { + num11 = 10; + } + if (num11 <= 0) + { + bool flag6 = false; + if (!flag4 && !flag5) + { + flag5 = true; + flag6 = true; + int num16 = WorldGen.genRand.Next(7, 13); + int num17 = WorldGen.genRand.Next(23, 28); + int num18 = num17; + int num19 = num8; + while (num17 > 0) + { + for (int num20 = num9 - num16 + num10; num20 <= num9 + num10; num20++) + { + if (num17 == num18 || num17 == 1) + { + if (num20 >= num9 - num16 + num10 + 2) + { + Main.tile[num8, num20].active(false); + } + } + else if (num17 == num18 - 1 || num17 == 2 || num17 == num18 - 2 || num17 == 3) + { + if (num20 >= num9 - num16 + num10 + 1) + { + Main.tile[num8, num20].active(false); + } + } + else + { + Main.tile[num8, num20].active(false); + } + } + num17--; + num8 += num7; + } + int num21 = num8 - num7; + int num22 = num21; + int num23 = num19; + if (num21 > num19) + { + num22 = num19; + num23 = num21; + } + int num24 = WorldGen.genRand.Next(3); + if (num24 == 0) + { + num24 = 1861; //diving gear + } + else if (num24 == 1) + { + num24 = 1163; //balloon + } + else if (num24 == 2) + { + num24 = 1253; //shell + } + WorldGen.AddBuriedChest((num22 + num23) / 2, num9, num24, false, 22); + int num25 = WorldGen.genRand.Next(1, 10); + for (int num26 = 0; num26 < num25; num26++) + { + int arg_49B_0 = WorldGen.genRand.Next(num22, num23); + int j2 = num9 + num10; + WorldGen.PlaceSmallPile(arg_49B_0, j2, WorldGen.genRand.Next(16, 19), 1, 185); + } + for (int num27 = num22; num27 <= num23; num27++) + { + WorldGen.PlacePot(num27, num9 + num10, 28, WorldGen.genRand.Next(4, 7)); + } + } + if (flag4) + { + flag4 = false; + num7 *= -1; + num11 = WorldGen.genRand.Next(15, 20); + } + else if (flag6) + { + num11 = WorldGen.genRand.Next(10, 15); + } + else + { + num7 *= -1; + num11 = WorldGen.genRand.Next(20, 40); + } + } + if (num9 >= num4 - num10) + { + flag2 = false; + } + } + int num28 = WorldGen.genRand.Next(20, 40); //100 200 + int num29 = WorldGen.genRand.Next(100, 160); //500 800 + flag2 = true; + int num30 = num10; + num11 = WorldGen.genRand.Next(10, 50); + if (num7 == 1) + { + num8 -= num30; + } + int num31 = WorldGen.genRand.Next(5, 10); + while (flag2) + { + num28--; + num29--; + num11--; + for (int num32 = num8 - num31 - WorldGen.genRand.Next(0, 2); num32 <= num8 + num30 + num31 + WorldGen.genRand.Next(0, 2); num32++) + { + int num33 = num9; + if (num32 >= num8 && num32 <= num8 + num30) + { + Main.tile[num32, num33].active(false); + } + else + { + Main.tile[num32, num33].type = num; + Main.tile[num32, num33].active(true); + Main.tile[num32, num33].halfBrick(false); + Main.tile[num32, num33].slope(0); + } + if (num32 >= num8 - 1 && num32 <= num8 + 1 + num30) + { + Main.tile[num32, num33].wall = 71; + } + } + num9++; + num8 += num7; + if (num28 <= 0) + { + flag2 = false; + for (int num34 = num8 + 1; num34 <= num8 + num30 - 1; num34++) + { + if (Main.tile[num34, num9].active()) + { + flag2 = true; + } + } + } + if (num11 < 0) + { + num11 = WorldGen.genRand.Next(10, 50); + num7 *= -1; + } + if (num29 <= 0) + { + flag2 = false; + } + } + return true; + } + #endregion + + #region SpecialHut + public static void SpecialHut(ushort tile, ushort tile2, ushort wall, int hutType, int chestX, int chestY) + { + int m = WorldGen.genRand.Next(2, 4); + int num6 = WorldGen.genRand.Next(2, 4); + for (int n = chestX - m - 1; n <= chestX + m + 1; n++) + { + for (int num8 = chestY - num6 - 1; num8 <= chestY + num6 + 1; num8++) + { + Main.tile[n, num8].active(true); + Main.tile[n, num8].type = tile; + Main.tile[n, num8].liquid = 0; + Main.tile[n, num8].lava(false); + } + } + for (int num9 = chestX - m; num9 <= chestX + m; num9++) + { + for (int num10 = chestY - num6; num10 <= chestY + num6; num10++) + { + Main.tile[num9, num10].active(false); + Main.tile[num9, num10].wall = wall; + } + } + for (int num14 = chestX - m - 1; num14 <= chestX + m + 1; num14++) + { + for (int num15 = chestY + num6 - 2; num15 <= chestY + num6; num15++) + { + Main.tile[num14, num15].active(false); + } + } + for (int num16 = chestX - m - 1; num16 <= chestX + m + 1; num16++) + { + for (int num17 = chestY + num6 - 2; num17 <= chestY + num6 - 1; num17++) + { + Main.tile[num16, num17].active(false); + } + } + for (int num18 = chestX - m - 1; num18 <= chestX + m + 1; num18++) + { + int num19 = 4; + int num20 = chestY + num6 + 2; + while (!Main.tile[num18, num20].active() && num20 < Main.maxTilesY && num19 > 0) + { + Main.tile[num18, num20].active(true); + Main.tile[num18, num20].type = tile2; + num20++; + num19--; + } + } + m -= WorldGen.genRand.Next(1, 3); + int num21 = chestY - num6 - 2; + while (m > -1) + { + for (int num22 = chestX - m - 1; num22 <= chestX + m + 1; num22++) + { + Main.tile[num22, num21].active(true); + Main.tile[num22, num21].type = tile; + } + m -= WorldGen.genRand.Next(1, 3); + num21--; + } + CalamityWorld.SChestX[hutType] = chestX; + CalamityWorld.SChestY[hutType] = chestY; + SpecialChest(hutType); + } + #endregion + + #region SpecialChest + public static void SpecialChest(int itemChoice) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + int item = 0; + int chestType = 0; + switch (itemChoice) //0 to 9 + { + case 0: item = mod.ItemType("TrinketofChi"); break; + case 1: item = (WorldGen.crimson ? mod.ItemType("CrimsonEffigy") : mod.ItemType("CorruptionEffigy")); chestType = (WorldGen.crimson ? 43 : 3); break; + case 2: item = mod.ItemType("OnyxExcavatorKey"); chestType = 44; break; + case 3: item = mod.ItemType("TundraLeash"); chestType = 47; break; + case 4: item = mod.ItemType("LuxorsGift"); chestType = 30; break; + case 5: item = mod.ItemType("FungalSymbiote"); chestType = 32; break; + case 6: item = mod.ItemType("UnstablePrism"); chestType = 50; break; + case 7: item = mod.ItemType("GladiatorsLocket"); chestType = 51; break; + case 8: item = mod.ItemType("Murasama"); chestType = 44; break; + case 9: item = mod.ItemType("BossRush"); chestType = 4; break; + } + for (int j = CalamityWorld.SChestX[itemChoice] - 1; j <= CalamityWorld.SChestX[itemChoice] + 1; j++) + { + for (int k = CalamityWorld.SChestY[itemChoice]; k <= CalamityWorld.SChestY[itemChoice] + 2; k++) + { + WorldGen.KillTile(j, k, false, false, false); + } + } + for (int l = CalamityWorld.SChestX[itemChoice] - 1; l <= CalamityWorld.SChestX[itemChoice] + 1; l++) + { + for (int m = CalamityWorld.SChestY[itemChoice]; m <= CalamityWorld.SChestY[itemChoice] + 3; m++) + { + if (m < Main.maxTilesY) + { + Main.tile[l, m].slope(0); + Main.tile[l, m].halfBrick(false); + } + } + } + WorldGen.AddBuriedChest(CalamityWorld.SChestX[itemChoice], CalamityWorld.SChestY[itemChoice], item, false, chestType); + } + #endregion + + #region ChasmGenerator + public static void ChasmGenerator(int i, int j, int steps, bool ocean = false) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + float num = (float)steps; //850 small 1450 medium 2050 large + if (ocean) + { + int tileYLookup = j; + if (CalamityWorld.abyssSide) + { + while (!Main.tile[i + 125, tileYLookup].active()) + { + tileYLookup++; + } + } + else + { + while (!Main.tile[i - 125, tileYLookup].active()) + { + tileYLookup++; + } + } + j = tileYLookup; + } + Vector2 vector; + vector.X = (float)i; + vector.Y = (float)j; + Vector2 vector2; + vector2.X = (float)WorldGen.genRand.Next(-1, 2) * 0.1f; + vector2.Y = (float)WorldGen.genRand.Next(3, 8) * 0.2f + 0.5f; + int num2 = 5; + double num3 = (double)(WorldGen.genRand.Next(5, 7) + 40); //start width + while (num3 > 0.0) + { + if (num > 0f) + { + num3 += (double)WorldGen.genRand.Next(2); + num3 -= (double)WorldGen.genRand.Next(2); + float smallHoleLimit = 790f; //small + if (Main.maxTilesY > 1500) { smallHoleLimit = 1360f; if (Main.maxTilesY > 2100) { smallHoleLimit = 1950f; } } + if (ocean && num > smallHoleLimit) + { + if (num3 < 4.0) //min width + { + num3 = 4.0; //min width + } + if (num3 > 6.0) //max width + { + num3 = 6.0; //max width + } + } + else //dig large hole + { + if (num3 < (ocean ? 42.0 : 14.0)) //min width + { + num3 = (ocean ? 42.0 : 14.0); //min width + } + if (num3 > (ocean ? 60.0 : 40.0)) //max width + { + num3 = (ocean ? 60.0 : 40.0); //max width + } + if (num == 1f && num3 < (ocean ? 50.0 : 20.0)) + { + num3 = (ocean ? 50.0 : 20.0); + } + } + } + else + { + if ((double)vector.Y > CalamityWorld.abyssChasmBottom) + { + num3 -= (double)(WorldGen.genRand.Next(5) + 8); + } + } + if (Main.maxTilesY > 2100) + { + if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || + ((double)vector.Y >= (double)Main.maxTilesY && num > 0f && !ocean)) + { + num = 0f; + } + } + else if (Main.maxTilesY > 1500) + { + if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || + ((double)vector.Y > (double)Main.maxTilesY && num > 0f && !ocean)) + { + num = 0f; + } + } + else + { + if (((double)vector.Y > CalamityWorld.abyssChasmBottom && num > 0f && ocean) || + ((double)vector.Y > (double)Main.maxTilesY && num > 0f && !ocean)) + { + num = 0f; + } + } + num -= 1f; + int num4; + int num5; + int num6; + int num7; + if (num > (float)num2) + { + num4 = (int)((double)vector.X - num3 * 0.5); + num5 = (int)((double)vector.X + num3 * 0.5); + num6 = (int)((double)vector.Y - num3 * 0.5); + num7 = (int)((double)vector.Y + num3 * 0.5); + if (num4 < 0) + { + num4 = 0; + } + if (num5 > Main.maxTilesX - 1) + { + num5 = Main.maxTilesX - 1; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int k = num4; k < num5; k++) + { + for (int l = num6; l < num7; l++) + { + if ((double)(Math.Abs((float)k - vector.X) + Math.Abs((float)l - vector.Y)) < num3 * 0.5 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) + { + if (ocean) + { + Main.tile[k, l].active(false); + Main.tile[k, l].liquid = 255; + Main.tile[k, l].lava(false); + } + else + { + Main.tile[k, l].active(false); + Main.tile[k, l].liquid = 255; + Main.tile[k, l].lava(true); + } + } + } + } + } + if (num <= 2f && (double)vector.Y < (Main.rockLayer + (double)Main.maxTilesY * 0.3)) + { + num = 2f; + } + vector += vector2; + vector2.X += (float)WorldGen.genRand.Next(-1, 2) * 0.01f; + if ((double)vector2.X > 0.02) + { + vector2.X = 0.02f; + } + if ((double)vector2.X < -0.02) + { + vector2.X = -0.02f; + } + num4 = (int)((double)vector.X - num3 * 1.1); + num5 = (int)((double)vector.X + num3 * 1.1); + num6 = (int)((double)vector.Y - num3 * 1.1); + num7 = (int)((double)vector.Y + num3 * 1.1); + if (num4 < 1) + { + num4 = 1; + } + if (num5 > Main.maxTilesX - 1) + { + num5 = Main.maxTilesX - 1; + } + if (num6 < 0) + { + num6 = 0; + } + if (num7 > Main.maxTilesY) + { + num7 = Main.maxTilesY; + } + for (int m = num4; m < num5; m++) + { + for (int n = num6; n < num7; n++) + { + if ((double)(Math.Abs((float)m - vector.X) + Math.Abs((float)n - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) + { + if (n > j + WorldGen.genRand.Next(7, 16)) + { + Main.tile[m, n].active(false); + } + if (steps <= num2) + { + Main.tile[m, n].active(false); + } + if (ocean) + { + Main.tile[m, n].liquid = 255; + Main.tile[m, n].lava(false); + } + else + { + Main.tile[m, n].liquid = 255; + Main.tile[m, n].lava(true); + } + } + } + } + for (int num11 = num4; num11 < num5; num11++) + { + for (int num12 = num6; num12 < num7; num12++) + { + if ((double)(Math.Abs((float)num11 - vector.X) + Math.Abs((float)num12 - vector.Y)) < num3 * 1.1 * (1.0 + (double)WorldGen.genRand.Next(-5, 6) * 0.015)) + { + if (ocean) + { + Main.tile[num11, num12].liquid = 255; + Main.tile[num11, num12].lava(false); + } + else + { + Main.tile[num11, num12].liquid = 255; + Main.tile[num11, num12].lava(true); + } + if (steps <= num2) + { + Main.tile[num11, num12].active(false); + } + } + } + } + } + } + #endregion + + #region PlaceTits + public static void PlaceTit(int x, int y, ushort type = 165) + { + Mod mod = ModLoader.GetMod("CalamityMod"); + if (Main.tile[x, y - 1] == null) + { + Main.tile[x, y - 1] = new Tile(); + } + if (Main.tile[x, y] == null) + { + Main.tile[x, y] = new Tile(); + } + if (Main.tile[x, y + 1] == null) + { + Main.tile[x, y + 1] = new Tile(); + } + if (WorldGen.SolidTile(x, y - 1) && !Main.tile[x, y].active() && !Main.tile[x, y + 1].active()) + { + if (Main.tile[x, y - 1].type == (ushort)mod.TileType("Navystone")) + { + if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y + 2].active()) + { + int num2 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y].type = type; + Main.tile[x, y].active(true); + Main.tile[x, y].frameX = (short)num2; + Main.tile[x, y].frameY = 72; + } + else + { + int num3 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y].type = type; + Main.tile[x, y].active(true); + Main.tile[x, y].frameX = (short)num3; + Main.tile[x, y].frameY = 0; + Main.tile[x, y + 1].type = type; + Main.tile[x, y + 1].active(true); + Main.tile[x, y + 1].frameX = (short)num3; + Main.tile[x, y + 1].frameY = 18; + } + } + } + else + { + if (WorldGen.SolidTile(x, y + 1) && !Main.tile[x, y].active() && !Main.tile[x, y - 1].active()) + { + if (Main.tile[x, y + 1].type == (ushort)mod.TileType("Navystone")) + { + if (WorldGen.genRand.Next(2) == 0 || Main.tile[x, y - 2].active()) + { + int num13 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y].type = type; + Main.tile[x, y].active(true); + Main.tile[x, y].frameX = (short)num13; + Main.tile[x, y].frameY = 90; + } + else + { + int num14 = WorldGen.genRand.Next(3) * 18; + Main.tile[x, y - 1].type = type; + Main.tile[x, y - 1].active(true); + Main.tile[x, y - 1].frameX = (short)num14; + Main.tile[x, y - 1].frameY = 36; + Main.tile[x, y].type = type; + Main.tile[x, y].active(true); + Main.tile[x, y].frameX = (short)num14; + Main.tile[x, y].frameY = 54; + } + } + } + } + } + #endregion + + #region Planetoids + public static void Planetoids(GenerationProgress progress) + { + progress.Message = "Generating Planetoids..."; + + int GrassPlanetoidCount = Main.maxTilesX / 1100; + int LCPlanetoidCount = Main.maxTilesX / 800; + int MudPlanetoidCount = Main.maxTilesX / 1100; + + while (true) + { + if (Biomes.Place(new Point(WorldGen.genRand.Next(Main.maxTilesX / 2 - 300, Main.maxTilesX / 2 + 300), WorldGen.genRand.Next(128, 134)), WorldGen.structures)) + { + break; + } + } + while (LCPlanetoidCount > 0) + { + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.2), (int)(Main.maxTilesX * 0.8)); + int y = WorldGen.genRand.Next(70, 101); + + bool placed = Biomes.Place(x, y, WorldGen.structures); + + if (placed) + LCPlanetoidCount--; + } + while (GrassPlanetoidCount > 0) + { + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.333), (int)(Main.maxTilesX * 0.666)); + int y = WorldGen.genRand.Next(100, 131); + + + bool placed = Biomes.Place(x, y, WorldGen.structures); + + if (placed) + GrassPlanetoidCount--; + } + while (MudPlanetoidCount > 0) + { + int x = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.3f), (int)(Main.maxTilesX * 0.7f)); + int y = WorldGen.genRand.Next(100, 131); + + bool placed = Biomes.Place(x, y, WorldGen.structures); + + if (placed) + MudPlanetoidCount--; + } + } + #endregion + } +} \ No newline at end of file diff --git a/build.txt b/build.txt index e88a31daa5..861683d9a4 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = MountainDrew -version = 1.4.2.003 +version = 1.4.2.101 displayName = Calamity Mod (No Calamity Music) homepage = https://forums.terraria.org/index.php?threads/calamity-mod.44065/ buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*, LICENSE, README.md, .editorconfig, .gitignore, .gitattributes diff --git a/description.txt b/description.txt index 997941f3e7..616411e1de 100644 --- a/description.txt +++ b/description.txt @@ -5,6 +5,6 @@ It currently contains: 4 new modes for extra challenge 3 new biomes 275+ new enemy NPCs -1530+ new items +1600+ new items Cross-content support for GRealm PLEASE BE ADVISED: Download the Calamity Mod Music mod if you want Calamity Mod music to be in your game! \ No newline at end of file